1 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
2 # Copyright (C) 1999-2002, 2006, 2010 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 # CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
25 # Shared library names:
27 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
28 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
39 # where make install puts libpng.a, libpng14.sl, and png.h
42 INCPATH=$(prefix)/include
43 LIBPATH=$(exec_prefix)/lib
45 BINPATH=$(exec_prefix)/bin
47 CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
48 # Caution: be sure you have built zlib with the same CFLAGS.
49 CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
50 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
52 # override DESTDIR= on the make install command line to easily support
53 # installing into a temporary location. Example:
55 # make install DESTDIR=/tmp/build/libpng
57 # If you're going to install into a temporary location
58 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
59 # you execute make install.
62 DB=$(DESTDIR)$(BINPATH)
63 DI=$(DESTDIR)$(INCPATH)
64 DL=$(DESTDIR)$(LIBPATH)
65 DM=$(DESTDIR)$(MANPATH)
67 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
68 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
69 pngwtran.o pngmem.o pngerror.o pngpread.o
71 OBJSDLL = $(OBJS:.o=.pic.o)
73 .SUFFIXES: .c .o .pic.o
76 $(CC) -c $(CFLAGS) +z -o $@ $*.c
78 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
85 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
86 -e s!@exec_prefix@!$(exec_prefix)! \
87 -e s!@libdir@!$(LIBPATH)! \
88 -e s!@includedir@!$(INCPATH)! \
89 -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
92 ( cat scripts/libpng-config-head.in; \
93 echo prefix=\"$(prefix)\"; \
94 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
95 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
96 echo L_opts=\"-L$(LIBPATH)\"; \
97 echo libs=\"-lpng14 -lz -lm\"; \
98 cat scripts/libpng-config-body.in ) > libpng-config
99 chmod +x libpng-config
101 $(LIBSO): $(LIBSOMAJ)
102 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
104 $(LIBSOMAJ): $(OBJSDLL)
106 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
108 pngtest: pngtest.o libpng.a
109 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
114 install-headers: png.h pngconf.h
115 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
116 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
117 cp png.h pngconf.h $(DI)/$(LIBNAME)
118 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
119 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
120 -@$(RM_F) $(DI)/libpng
121 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
123 install-static: install-headers libpng.a
124 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
125 cp libpng.a $(DL)/$(LIBNAME).a
126 chmod 644 $(DL)/$(LIBNAME).a
127 -@$(RM_F) $(DL)/libpng.a
128 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
130 install-shared: install-headers $(LIBSOMAJ) libpng.pc
131 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
132 -@$(RM_F) $(DL)/$(LIBSO)
133 -@$(RM_F) $(DL)/$(LIBSOREL)
134 -@$(RM_F) $(DL)/$(OLDSO)
135 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
136 chmod 755 $(DL)/$(LIBSOREL)
138 $(LN_SF) $(LIBSOREL) $(LIBSO); \
139 $(LN_SF) $(LIBSO) $(OLDSO))
140 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
141 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
142 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
143 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
144 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
145 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
147 install-man: libpng.3 libpngpf.3 png.5
148 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
149 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
150 -@$(RM_F) $(DM)/man3/libpng.3
151 -@$(RM_F) $(DM)/man3/libpngpf.3
152 cp libpng.3 $(DM)/man3
153 cp libpngpf.3 $(DM)/man3
154 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
155 -@$(RM_F) $(DM)/man5/png.5
158 install-config: libpng-config
159 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
160 -@$(RM_F) $(DB)/libpng-config
161 -@$(RM_F) $(DB)/$(LIBNAME)-config
162 cp libpng-config $(DB)/$(LIBNAME)-config
163 chmod 755 $(DB)/$(LIBNAME)-config
164 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
166 install: install-static install-shared install-man install-config
168 # If you installed in $(DESTDIR), test-installed won't work until you
169 # move the library to its final location. Use test-dd to test it
174 echo Testing installed dynamic shared library in $(DL).
175 $(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
176 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
177 -L$(DL) -L$(ZLIBLIB) \
178 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
179 ./pngtestd pngtest.png
183 echo Testing installed dynamic shared library.
185 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
187 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
188 ./pngtesti pngtest.png
191 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
192 libpng-config $(LIBSO) $(LIBSOMAJ)* \
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 pngpriv.h
202 pngerror.o: png.h pngconf.h pngpriv.h
203 pngrio.o: png.h pngconf.h pngpriv.h
204 pngwio.o: png.h pngconf.h pngpriv.h
205 pngmem.o: png.h pngconf.h pngpriv.h
206 pngset.o: png.h pngconf.h pngpriv.h
207 pngget.o: png.h pngconf.h pngpriv.h
208 pngread.o: png.h pngconf.h pngpriv.h
209 pngrtran.o: png.h pngconf.h pngpriv.h
210 pngrutil.o: png.h pngconf.h pngpriv.h
211 pngtrans.o: png.h pngconf.h pngpriv.h
212 pngwrite.o: png.h pngconf.h pngpriv.h
213 pngwtran.o: png.h pngconf.h pngpriv.h
214 pngwutil.o: png.h pngconf.h pngpriv.h
215 pngpread.o: png.h pngconf.h pngpriv.h
217 pngtest.o: png.h pngconf.h