1 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
2 # Copyright (C) 1999-2002 Glenn Randers-Pehrson
3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42
4 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
5 # For conditions of distribution and use, see copyright notice in png.h
7 # Where the zlib library and include files are located
9 ZLIBINC=/opt/zlib/include
11 # Note that if you plan to build a libpng shared library, zlib must also
12 # be a shared library, which zlib's configure does not do. After running
13 # zlib's configure, edit the appropriate lines of makefile to read:
14 # CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
19 CFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
20 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
21 # Caution: be sure you have built zlib with the same CFLAGS.
22 CCFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
23 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
25 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
31 PNGVER = $(PNGMAJ).$(PNGMIN)
34 # where make install puts libpng.a, libpng12.sl, and png.h
36 INCPATH=$(prefix)/include
41 # override DESTDIR= on the make install command line to easily support
42 # installing into a temporary location. Example:
44 # make install DESTDIR=/tmp/build/libpng
46 # If you're going to install into a temporary location
47 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
48 # you execute make install.
51 DB=$(DESTDIR)$(BINPATH)
52 DI=$(DESTDIR)$(INCPATH)
53 DL=$(DESTDIR)$(LIBPATH)
54 DM=$(DESTDIR)$(MANPATH)
56 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
57 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
58 pngwtran.o pngmem.o pngerror.o pngpread.o
60 OBJSDLL = $(OBJS:.o=.pic.o)
62 .SUFFIXES: .c .o .pic.o
65 $(CC) -c $(CFLAGS) +z -o $@ $*.c
67 all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
74 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
77 ( cat scripts/libpng-config-head.in; \
78 echo prefix=\"$(prefix)\"; \
79 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
80 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
81 echo L_opts=\"-L$(LIBPATH)\"; \
82 echo libs=\"-lpng12 -lz -lm\"; \
83 cat scripts/libpng-config-body.in ) > libpng-config
84 chmod +x libpng-config
86 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
87 ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
89 $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
90 ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
92 $(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
94 +h $(LIBNAME).sl.$(PNGMAJ) -o $(LIBNAME).sl.$(PNGVER) $(OBJSDLL)
96 libpng.sl.3.$(PNGMIN): $(OBJSDLL)
98 +h libpng.sl.3 -o libpng.sl.3.$(PNGMIN) $(OBJSDLL)
100 pngtest: pngtest.o libpng.a
101 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
106 install-headers: png.h pngconf.h
107 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
108 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
109 cp png.h pngconf.h $(DI)/$(LIBNAME)
110 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
111 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
112 -@/bin/rm -f $(DI)/libpng
113 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
115 install-static: install-headers libpng.a
116 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
117 cp libpng.a $(DL)/$(LIBNAME).a
118 chmod 644 $(DL)/$(LIBNAME).a
119 -@/bin/rm -f $(DL)/libpng.a
120 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
122 install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
123 libpng.sl.3.$(PNGMIN)
124 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
125 -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
126 -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)
127 -@/bin/rm -f $(DL)/libpng.sl
128 -@/bin/rm -f $(DL)/libpng.sl.3
129 -@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
130 cp $(LIBNAME).sl.$(PNGVER) $(DL)
131 cp libpng.sl.3.$(PNGMIN) $(DL)
132 chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
133 chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
135 ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
136 ln -sf libpng.sl.3 libpng.sl; \
137 ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
138 ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
139 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
140 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
141 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
142 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
143 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
144 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
146 install-man: libpng.3 libpngpf.3 png.5
147 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
148 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
149 -@/bin/rm -f $(DM)/man3/libpng.3
150 -@/bin/rm -f $(DM)/man3/libpngpf.3
151 cp libpng.3 $(DM)/man3
152 cp libpngpf.3 $(DM)/man3
153 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
154 -@/bin/rm -f $(DM)/man5/png.5
157 install-config: libpng-config
158 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
159 -@/bin/rm -f $(DB)/libpng-config
160 -@/bin/rm -f $(DB)/$(LIBNAME)-config
161 cp libpng-config $(DB)/$(LIBNAME)-config
162 chmod 755 $(DB)/$(LIBNAME)-config
163 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
165 install: install-static install-shared install-man install-config
167 # If you installed in $(DESTDIR), test-installed won't work until you
168 # move the library to its final location. Use test-dd to test it
173 echo Testing installed dynamic shared library in $(DL).
174 $(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
175 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
176 -L$(DL) -L$(ZLIBLIB) \
177 -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
178 ./pngtestd pngtest.png
182 echo Testing installed dynamic shared library.
184 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
186 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
187 ./pngtesti pngtest.png
190 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
191 libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
192 libpng.sl.3.$(PNGMIN) \
195 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
197 chmod a-w *.[ch35] $(DOCS) scripts/*
199 # DO NOT DELETE THIS LINE -- make depend depends on it.
201 png.o: png.h pngconf.h
202 pngerror.o: png.h pngconf.h
203 pngrio.o: png.h pngconf.h
204 pngwio.o: png.h pngconf.h
205 pngmem.o: png.h pngconf.h
206 pngset.o: png.h pngconf.h
207 pngget.o: png.h pngconf.h
208 pngread.o: png.h pngconf.h
209 pngrtran.o: png.h pngconf.h
210 pngrutil.o: png.h pngconf.h
211 pngtest.o: png.h pngconf.h
212 pngtrans.o: png.h pngconf.h
213 pngwrite.o: png.h pngconf.h
214 pngwtran.o: png.h pngconf.h
215 pngwutil.o: png.h pngconf.h
216 pngpread.o: png.h pngconf.h