1 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
2 # Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42
4 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
6 # This code is released under the libpng license.
7 # For conditions of distribution and use, see the disclaimer
10 # Where the zlib library and include files are located
12 ZLIBINC=/opt/zlib/include
14 # Note that if you plan to build a libpng shared library, zlib must also
15 # be a shared library, which zlib's configure does not do. After running
16 # zlib's configure, edit the appropriate lines of makefile to read:
17 # CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP
26 # Shared library names:
28 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
29 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
40 # where make install puts libpng.a, libpng16.sl, and png.h
43 INCPATH=$(prefix)/include
44 LIBPATH=$(exec_prefix)/lib
46 BINPATH=$(exec_prefix)/bin
49 CFLAGS=-O -Ae +DA1.1 +DS2.0
50 # Caution: be sure you have built zlib with the same CFLAGS.
51 CCFLAGS=-O -Ae +DA1.1 +DS2.0
52 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
54 # override DESTDIR= on the make install command line to easily support
55 # installing into a temporary location. Example:
57 # make install DESTDIR=/tmp/build/libpng
59 # If you're going to install into a temporary location
60 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
61 # you execute make install.
64 DB=$(DESTDIR)$(BINPATH)
65 DI=$(DESTDIR)$(INCPATH)
66 DL=$(DESTDIR)$(LIBPATH)
67 DM=$(DESTDIR)$(MANPATH)
69 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
70 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
71 pngwtran.o pngmem.o pngerror.o pngpread.o
73 OBJSDLL = $(OBJS:.o=.pic.o)
75 .SUFFIXES: .c .o .pic.o
78 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
81 $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
83 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
85 # see scripts/pnglibconf.mak for more options
86 pnglibconf.h: scripts/pnglibconf.h.prebuilt
87 cp scripts/pnglibconf.h.prebuilt $@
94 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
95 -e s!@exec_prefix@!$(exec_prefix)! \
96 -e s!@libdir@!$(LIBPATH)! \
97 -e s!@includedir@!$(INCPATH)! \
98 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
101 ( cat scripts/libpng-config-head.in; \
102 echo prefix=\"$(prefix)\"; \
103 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
104 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
105 echo L_opts=\"-L$(LIBPATH)\"; \
106 echo libs=\"-lpng16 -lz -lm\"; \
107 cat scripts/libpng-config-body.in ) > libpng-config
108 chmod +x libpng-config
110 $(LIBSO): $(LIBSOMAJ)
111 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
113 $(LIBSOMAJ): $(OBJSDLL)
115 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
117 pngtest: pngtest.o libpng.a
118 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
123 install-headers: png.h pngconf.h pnglibconf.h
124 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
125 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
126 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
127 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
128 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
129 -@$(RM_F) $(DI)/libpng
130 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
132 install-static: install-headers libpng.a
133 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
134 cp libpng.a $(DL)/$(LIBNAME).a
135 chmod 644 $(DL)/$(LIBNAME).a
136 -@$(RM_F) $(DL)/libpng.a
137 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
139 install-shared: install-headers $(LIBSOMAJ) libpng.pc
140 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
141 -@$(RM_F) $(DL)/$(LIBSO)
142 -@$(RM_F) $(DL)/$(LIBSOREL)
143 -@$(RM_F) $(DL)/$(OLDSO)
144 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
145 chmod 755 $(DL)/$(LIBSOREL)
147 $(LN_SF) $(LIBSOREL) $(LIBSO); \
148 $(LN_SF) $(LIBSO) $(OLDSO))
149 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
150 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
151 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
152 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
153 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
154 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
156 install-man: libpng.3 libpngpf.3 png.5
157 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
158 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
159 -@$(RM_F) $(DM)/man3/libpng.3
160 -@$(RM_F) $(DM)/man3/libpngpf.3
161 cp libpng.3 $(DM)/man3
162 cp libpngpf.3 $(DM)/man3
163 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
164 -@$(RM_F) $(DM)/man5/png.5
167 install-config: libpng-config
168 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
169 -@$(RM_F) $(DB)/libpng-config
170 -@$(RM_F) $(DB)/$(LIBNAME)-config
171 cp libpng-config $(DB)/$(LIBNAME)-config
172 chmod 755 $(DB)/$(LIBNAME)-config
173 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
175 install: install-static install-shared install-man install-config
177 # If you installed in $(DESTDIR), test-installed won't work until you
178 # move the library to its final location. Use test-dd to test it
183 echo Testing installed dynamic shared library in $(DL).
184 $(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
185 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
186 -L$(DL) -L$(ZLIBLIB) \
187 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
188 ./pngtestd pngtest.png
192 echo Testing installed dynamic shared library.
193 $(CC) $(CPPFLAGS) $(CCFLAGS) \
194 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
196 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
197 ./pngtesti pngtest.png
200 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
201 libpng-config $(LIBSO) $(LIBSOMAJ)* \
202 libpng.pc pnglibconf.h
204 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
206 chmod a-w *.[ch35] $(DOCS) scripts/*
208 # DO NOT DELETE THIS LINE -- make depend depends on it.
210 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
211 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
212 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
213 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
214 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
215 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
216 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
217 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
226 pngtest.o: png.h pngconf.h pnglibconf.h