1 # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
2 # Copyright (C) 2002, 2006-2008 Glenn Randers-Pehrson
3 # Copyright (C) 2001, Laurent faillie
4 # Copyright (C) 1998, 1999 Greg Roelofs
5 # Copyright (C) 1996, 1997 Andreas Dilger
7 # This code is released under the libpng license.
8 # For conditions of distribution and use, see the disclaimer
15 PNGVER = $(PNGMAJ).$(PNGMIN)
17 # Shared library names:
19 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
20 LIBSOVER=$(LIBNAME).sl.$(PNGVER)
23 OLDSOVER=libpng.sl.3.$(PNGMIN)
34 # where "make install" puts libpng.a, $(OLDSO)*, png.h and pngconf.h
38 # Where the zlib library and include files are located
40 ZLIBINC=/opt/zlib/include
42 # Note that if you plan to build a libpng shared library, zlib must also
43 # be a shared library, which zlib's configure does not do. After running
44 # zlib's configure, edit the appropriate lines of makefile to read:
45 # CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
51 #ALIGN=-malign-loops=2 -malign-functions=2
53 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
54 -Wmissing-declarations -Wtraditional -Wcast-align \
55 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
57 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
59 CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
60 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
61 #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
62 LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
64 INCPATH=$(prefix)/include
65 LIBPATH=$(exec_prefix)/lib
67 BINPATH=$(exec_prefix)/bin
69 # override DESTDIR= on the make install command line to easily support
70 # installing into a temporary location. Example:
72 # make install DESTDIR=/tmp/build/libpng
74 # If you're going to install into a temporary location
75 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
76 # you execute make install.
79 DB=$(DESTDIR)$(BINPATH)
80 DI=$(DESTDIR)$(INCPATH)
81 DL=$(DESTDIR)$(LIBPATH)
82 DM=$(DESTDIR)$(MANPATH)
84 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
85 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
86 pngwtran.o pngmem.o pngerror.o pngpread.o
88 OBJSDLL = $(OBJS:.o=.pic.o)
90 .SUFFIXES: .c .o .pic.o
93 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
95 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
102 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
103 -e s!@exec_prefix@!$(exec_prefix)! \
104 -e s!@libdir@!$(LIBPATH)! \
105 -e s!@includedir@!$(INCPATH)! \
106 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
109 ( cat scripts/libpng-config-head.in; \
110 echo prefix=\"$(prefix)\"; \
111 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
112 echo libs=\"-lpng12 -lz -lm\"; \
113 cat scripts/libpng-config-body.in ) > libpng-config
114 chmod +x libpng-config
116 $(LIBSO): $(LIBSOMAJ)
117 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
119 $(LIBSOMAJ): $(LIBSOVER)
120 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
122 $(LIBSOVER): $(OBJSDLL)
124 +h $(LIBSOMAJ) -o $(LIBSOVER) $(OBJSDLL)
126 $(OLDSOVER): $(OBJSDLL)
128 +h $(OLDSOMAJ) -o $(OLDSOVER) $(OBJSDLL)
130 pngtest: pngtest.o $(LIBSO)
131 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
137 install-headers: png.h pngconf.h
138 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
139 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
140 cp png.h pngconf.h $(DI)/$(LIBNAME)
141 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
142 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
143 -@$(RM_F) $(DI)/libpng
144 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
146 install-static: install-headers libpng.a
147 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
148 cp libpng.a $(DL)/$(LIBNAME).a
149 chmod 644 $(DL)/$(LIBNAME).a
150 -@$(RM_F) $(DL)/libpng.a
151 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
153 install-shared: install-headers $(LIBSOVER) libpng.pc \
155 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
156 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
157 -@$(RM_F) $(DL)/$(LIBSOMAJ)
158 -@$(RM_F) $(DL)/$(OLDSO)
159 -@$(RM_F) $(DL)/$(OLDSOMAJ)
160 -@$(RM_F) $(DL)/$(OLDSOVER)*
163 chmod 755 $(DL)/$(LIBSOVER)
164 chmod 755 $(DL)/$(OLDSOVER)
166 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
167 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
168 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
169 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
170 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
171 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
172 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
173 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
174 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
175 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
177 install-man: libpng.3 libpngpf.3 png.5
178 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
179 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
180 -@$(RM_F) $(DM)/man3/libpng.3
181 -@$(RM_F) $(DM)/man3/libpngpf.3
182 cp libpng.3 $(DM)/man3
183 cp libpngpf.3 $(DM)/man3
184 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
185 -@$(RM_F) $(DM)/man5/png.5
188 install-config: libpng-config
189 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
190 -@$(RM_F) $(DB)/libpng-config
191 -@$(RM_F) $(DB)/$(LIBNAME)-config
192 cp libpng-config $(DB)/$(LIBNAME)-config
193 chmod 755 $(DB)/$(LIBNAME)-config
194 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
196 install: install-static install-shared install-man install-config
198 # If you installed in $(DESTDIR), test-installed won't work until you
199 # move the library to its final location. Use test-dd to test it
204 echo Testing installed dynamic shared library in $(DL).
205 $(CC) -I$(DI) -I$(ZLIBINC) \
206 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
207 -L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
208 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
209 ./pngtestd pngtest.png
213 echo Testing installed dynamic shared library.
215 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
216 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
217 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
218 ./pngtesti pngtest.png
221 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
222 libpng-config $(LIBSO) $(LIBSOMAJ)* \
226 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
228 chmod a-w *.[ch35] $(DOCS) scripts/*
230 # DO NOT DELETE THIS LINE -- make depend depends on it.
232 png.o png.pic.o: png.h pngconf.h
233 pngerror.o pngerror.pic.o: png.h pngconf.h
234 pngrio.o pngrio.pic.o: png.h pngconf.h
235 pngwio.o pngwio.pic.o: png.h pngconf.h
236 pngmem.o pngmem.pic.o: png.h pngconf.h
237 pngset.o pngset.pic.o: png.h pngconf.h
238 pngget.o pngget.pic.o: png.h pngconf.h
239 pngread.o pngread.pic.o: png.h pngconf.h
240 pngrtran.o pngrtran.pic.o: png.h pngconf.h
241 pngrutil.o pngrutil.pic.o: png.h pngconf.h
242 pngtrans.o pngtrans.pic.o: png.h pngconf.h
243 pngwrite.o pngwrite.pic.o: png.h pngconf.h
244 pngwtran.o pngwtran.pic.o: png.h pngconf.h
245 pngwutil.o pngwutil.pic.o: png.h pngconf.h
246 pngpread.o pngpread.pic.o: png.h pngconf.h
248 pngtest.o: png.h pngconf.h