1 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
2 # Copyright (C) 1999-2002, 2006 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 \
22 PNGVER = $(PNGMAJ).$(PNGMIN)
24 # Shared library names:
26 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
27 LIBSOVER=$(LIBNAME).sl.$(PNGVER)
30 OLDSOVER=libpng.sl.3.$(PNGMIN)
40 # where make install puts libpng.a, libpng12.sl, and png.h
43 INCPATH=$(prefix)/include
44 LIBPATH=$(exec_prefix)/lib
46 BINPATH=$(exec_prefix)/bin
48 CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 -DPNG_NO_MMX_CODE
49 # Caution: be sure you have built zlib with the same CFLAGS.
50 CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
51 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
53 # override DESTDIR= on the make install command line to easily support
54 # installing into a temporary location. Example:
56 # make install DESTDIR=/tmp/build/libpng
58 # If you're going to install into a temporary location
59 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
60 # you execute make install.
63 DB=$(DESTDIR)$(BINPATH)
64 DI=$(DESTDIR)$(INCPATH)
65 DL=$(DESTDIR)$(LIBPATH)
66 DM=$(DESTDIR)$(MANPATH)
68 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
69 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
70 pngwtran.o pngmem.o pngerror.o pngpread.o
72 OBJSDLL = $(OBJS:.o=.pic.o)
74 .SUFFIXES: .c .o .pic.o
77 $(CC) -c $(CFLAGS) +z -o $@ $*.c
79 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
86 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
89 ( cat scripts/libpng-config-head.in; \
90 echo prefix=\"$(prefix)\"; \
91 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
92 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
93 echo L_opts=\"-L$(LIBPATH)\"; \
94 echo libs=\"-lpng12 -lz -lm\"; \
95 cat scripts/libpng-config-body.in ) > libpng-config
96 chmod +x libpng-config
99 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
101 $(LIBSOMAJ): $(LIBSOVER)
102 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
104 $(LIBSOVER): $(OBJSDLL)
106 +h $(LIBSOMAJ) -o $(LIBSOVER) $(OBJSDLL)
108 $(OLDSOVER): $(OBJSDLL)
110 +h $(OLDSOMAJ) -o $(OLDSOVER) $(OBJSDLL)
112 pngtest: pngtest.o libpng.a
113 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
118 install-headers: png.h pngconf.h
119 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
120 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
121 cp png.h pngconf.h $(DI)/$(LIBNAME)
122 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
123 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
124 -@$(RM_F) $(DI)/libpng
125 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
127 install-static: install-headers libpng.a
128 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
129 cp libpng.a $(DL)/$(LIBNAME).a
130 chmod 644 $(DL)/$(LIBNAME).a
131 -@$(RM_F) $(DL)/libpng.a
132 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
134 install-shared: install-headers $(LIBSOVER) libpng.pc \
136 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
137 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
138 -@$(RM_F) $(DL)/$(LIBSOMAJ)
139 -@$(RM_F) $(DL)/$(OLDSO)
140 -@$(RM_F) $(DL)/$(OLDSOMAJ)
141 -@$(RM_F) $(DL)/$(OLDSOVER)*
144 chmod 755 $(DL)/$(LIBSOVER)
145 chmod 755 $(DL)/$(OLDSOVER)
147 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
148 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
149 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
150 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
151 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
152 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
153 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
154 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
155 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
156 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
158 install-man: libpng.3 libpngpf.3 png.5
159 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
160 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
161 -@$(RM_F) $(DM)/man3/libpng.3
162 -@$(RM_F) $(DM)/man3/libpngpf.3
163 cp libpng.3 $(DM)/man3
164 cp libpngpf.3 $(DM)/man3
165 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
166 -@$(RM_F) $(DM)/man5/png.5
169 install-config: libpng-config
170 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
171 -@$(RM_F) $(DB)/libpng-config
172 -@$(RM_F) $(DB)/$(LIBNAME)-config
173 cp libpng-config $(DB)/$(LIBNAME)-config
174 chmod 755 $(DB)/$(LIBNAME)-config
175 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
177 install: install-static install-shared install-man install-config
179 # If you installed in $(DESTDIR), test-installed won't work until you
180 # move the library to its final location. Use test-dd to test it
185 echo Testing installed dynamic shared library in $(DL).
186 $(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
187 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
188 -L$(DL) -L$(ZLIBLIB) \
189 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
190 ./pngtestd pngtest.png
194 echo Testing installed dynamic shared library.
196 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
198 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
199 ./pngtesti pngtest.png
202 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
203 libpng-config $(LIBSO) $(LIBSOMAJ)* \
207 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
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
214 pngerror.o: png.h pngconf.h
215 pngrio.o: png.h pngconf.h
216 pngwio.o: png.h pngconf.h
217 pngmem.o: png.h pngconf.h
218 pngset.o: png.h pngconf.h
219 pngget.o: png.h pngconf.h
220 pngread.o: png.h pngconf.h
221 pngrtran.o: png.h pngconf.h
222 pngrutil.o: png.h pngconf.h
223 pngtest.o: png.h pngconf.h
224 pngtrans.o: png.h pngconf.h
225 pngwrite.o: png.h pngconf.h
226 pngwtran.o: png.h pngconf.h
227 pngwutil.o: png.h pngconf.h
228 pngpread.o: png.h pngconf.h