1 # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
2 # Copyright (C) 2002, 2006-2008, 2010 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 # Shared library names:
17 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
18 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
30 # where "make install" puts libpng.a, $(OLDSO)*, png.h and pngconf.h
34 # Where the zlib library and include files are located
36 ZLIBINC=/opt/zlib/include
38 # Note that if you plan to build a libpng shared library, zlib must also
39 # be a shared library, which zlib's configure does not do. After running
40 # zlib's configure, edit the appropriate lines of makefile to read:
41 # CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
47 #ALIGN=-malign-loops=2 -malign-functions=2
49 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
50 -Wmissing-declarations -Wtraditional -Wcast-align \
51 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
53 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
55 CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
56 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
57 #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng14 -lz -lm
58 LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz -lm
60 INCPATH=$(prefix)/include
61 LIBPATH=$(exec_prefix)/lib
63 BINPATH=$(exec_prefix)/bin
65 # override DESTDIR= on the make install command line to easily support
66 # installing into a temporary location. Example:
68 # make install DESTDIR=/tmp/build/libpng
70 # If you're going to install into a temporary location
71 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
72 # you execute make install.
75 DB=$(DESTDIR)$(BINPATH)
76 DI=$(DESTDIR)$(INCPATH)
77 DL=$(DESTDIR)$(LIBPATH)
78 DM=$(DESTDIR)$(MANPATH)
80 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
81 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
82 pngwtran.o pngmem.o pngerror.o pngpread.o
84 OBJSDLL = $(OBJS:.o=.pic.o)
86 .SUFFIXES: .c .o .pic.o
89 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
91 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
98 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
99 -e s!@exec_prefix@!$(exec_prefix)! \
100 -e s!@libdir@!$(LIBPATH)! \
101 -e s!@includedir@!$(INCPATH)! \
102 -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
105 ( cat scripts/libpng-config-head.in; \
106 echo prefix=\"$(prefix)\"; \
107 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
108 echo libs=\"-lpng14 -lz -lm\"; \
109 cat scripts/libpng-config-body.in ) > libpng-config
110 chmod +x libpng-config
112 $(LIBSO): $(LIBSOMAJ)
113 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
115 $(LIBSOMAJ): $(OBJSDLL)
117 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
119 pngtest: pngtest.o $(LIBSO)
120 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
126 install-headers: png.h pngconf.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 $(DI)/$(LIBNAME)
130 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
131 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.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) -I$(ZLIBINC) \
188 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
189 -L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
190 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
191 ./pngtestd pngtest.png
195 echo Testing installed dynamic shared library.
197 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
198 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
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)* \
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.pic.o: png.h pngconf.h pngpriv.h
214 pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h
215 pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h
216 pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h
217 pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h
218 pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h
219 pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h
220 pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h
221 pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h
222 pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h
223 pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h
224 pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h
225 pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h
226 pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h
227 pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h
229 pngtest.o: png.h pngconf.h