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 # Pre-built configuration
70 # See scripts/pnglibconf.mak for more options
71 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
73 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
74 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
75 pngwtran.o pngmem.o pngerror.o pngpread.o
77 OBJSDLL = $(OBJS:.o=.pic.o)
79 .SUFFIXES: .c .o .pic.o
82 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
85 $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
87 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
89 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
90 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
97 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
98 -e s!@exec_prefix@!$(exec_prefix)! \
99 -e s!@libdir@!$(LIBPATH)! \
100 -e s!@includedir@!$(INCPATH)! \
101 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
104 ( cat scripts/libpng-config-head.in; \
105 echo prefix=\"$(prefix)\"; \
106 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
107 echo ccopts=\"-O -Ae +DA1.1 +DS2.0\"; \
108 echo L_opts=\"-L$(LIBPATH)\"; \
109 echo libs=\"-lpng16 -lz -lm\"; \
110 cat scripts/libpng-config-body.in ) > libpng-config
111 chmod +x libpng-config
113 $(LIBSO): $(LIBSOMAJ)
114 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
116 $(LIBSOMAJ): $(OBJSDLL)
118 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
120 pngtest: pngtest.o libpng.a
121 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
126 install-headers: png.h pngconf.h pnglibconf.h
127 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
128 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
129 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
130 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
131 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
132 -@$(RM_F) $(DI)/libpng
133 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
135 install-static: install-headers libpng.a
136 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
137 cp libpng.a $(DL)/$(LIBNAME).a
138 chmod 644 $(DL)/$(LIBNAME).a
139 -@$(RM_F) $(DL)/libpng.a
140 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
142 install-shared: install-headers $(LIBSOMAJ) libpng.pc
143 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
144 -@$(RM_F) $(DL)/$(LIBSO)
145 -@$(RM_F) $(DL)/$(LIBSOREL)
146 -@$(RM_F) $(DL)/$(OLDSO)
147 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
148 chmod 755 $(DL)/$(LIBSOREL)
150 $(LN_SF) $(LIBSOREL) $(LIBSO); \
151 $(LN_SF) $(LIBSO) $(OLDSO))
152 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
153 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
154 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
155 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
156 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
157 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
159 install-man: libpng.3 libpngpf.3 png.5
160 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
161 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
162 -@$(RM_F) $(DM)/man3/libpng.3
163 -@$(RM_F) $(DM)/man3/libpngpf.3
164 cp libpng.3 $(DM)/man3
165 cp libpngpf.3 $(DM)/man3
166 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
167 -@$(RM_F) $(DM)/man5/png.5
170 install-config: libpng-config
171 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
172 -@$(RM_F) $(DB)/libpng-config
173 -@$(RM_F) $(DB)/$(LIBNAME)-config
174 cp libpng-config $(DB)/$(LIBNAME)-config
175 chmod 755 $(DB)/$(LIBNAME)-config
176 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
178 install: install-static install-shared install-man install-config
180 # If you installed in $(DESTDIR), test-installed won't work until you
181 # move the library to its final location. Use test-dd to test it
186 echo Testing installed dynamic shared library in $(DL).
187 $(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
188 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
189 -L$(DL) -L$(ZLIBLIB) \
190 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
191 ./pngtestd pngtest.png
195 echo Testing installed dynamic shared library.
196 $(CC) $(CPPFLAGS) $(CCFLAGS) \
197 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
199 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
200 ./pngtesti pngtest.png
203 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
204 libpng-config $(LIBSO) $(LIBSOMAJ)* \
205 libpng.pc pnglibconf.h
207 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO
209 chmod a-w *.[ch35] $(DOCS) scripts/*
211 # DO NOT DELETE THIS LINE -- make depend depends on it.
213 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
214 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
215 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
216 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
217 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
225 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
226 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
227 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
229 pngtest.o: png.h pngconf.h pnglibconf.h