1 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. 2 # Copyright (C) 1999-2002, 2006, 2010-2014 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 # 6 # This code is released under the libpng license. 7 # For conditions of distribution and use, see the disclaimer 8 # and license in png.h 9 10 # Where the zlib library and include files are located 11 ZLIBLIB=/opt/zlib/lib 12 ZLIBINC=/opt/zlib/include 13 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 # CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP 18 # CFLAGS=-O1 -fPIC 19 # LDSHARED=ld -b 20 # SHAREDLIB=libz.sl 21 22 # Library name: 23 LIBNAME = libpng16 24 PNGMAJ = 16 25 26 # Shared library names: 27 LIBSO=$(LIBNAME).sl 28 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ) 29 LIBSOREL=$(LIBSOMAJ).$(RELEASE) 30 OLDSO=libpng.sl 31 32 # Utilities: 33 AR_RC=ar rc 34 CC=cc 35 MKDIR_P=mkdir -p 36 LN_SF=ln -sf 37 RANLIB=ranlib 38 RM_F=/bin/rm -f 39 40 # where make install puts libpng.a, libpng16.sl, and png.h 41 prefix=/opt/libpng 42 exec_prefix=$(prefix) 43 INCPATH=$(prefix)/include 44 LIBPATH=$(exec_prefix)/lib 45 MANPATH=$(prefix)/man 46 BINPATH=$(exec_prefix)/bin 47 48 CPPFLAGS=-I$(ZLIBINC) 49 CFLAGS=-O -Ae +DA1.1 +DS2.0 50 # Caution: be sure you have built zlib with the same CFLAGS. 51 CCFLAGS=-O -Ae +DA1.1 +DS2.0 52 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm 53 54 # override DESTDIR= on the make install command line to easily support 55 # installing into a temporary location. Example: 56 # 57 # make install DESTDIR=/tmp/build/libpng 58 # 59 # If you're going to install into a temporary location 60 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before 61 # you execute make install. 62 DESTDIR= 63 64 DB=$(DESTDIR)$(BINPATH) 65 DI=$(DESTDIR)$(INCPATH) 66 DL=$(DESTDIR)$(LIBPATH) 67 DM=$(DESTDIR)$(MANPATH) 68 69 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ 70 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ 71 pngwtran.o pngmem.o pngerror.o pngpread.o 72 73 OBJSDLL = $(OBJS:.o=.pic.o) 74 75 .SUFFIXES: .c .o .pic.o 76 77 .c.o: 78 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 79 80 .c.pic.o: 81 $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c 82 83 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config 84 85 # see scripts/pnglibconf.mak for more options 86 pnglibconf.h: scripts/pnglibconf.h.prebuilt 87 cp scripts/pnglibconf.h.prebuilt $@ 88 89 libpng.a: $(OBJS) 90 $(AR_RC) $@ $(OBJS) 91 $(RANLIB) $@ 92 93 libpng.pc: 94 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ 95 -e s!@exec_prefix@!$(exec_prefix)! \ 96 -e s!@libdir@!$(LIBPATH)! \ 97 -e s!@includedir@!$(INCPATH)! \ 98 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc 99 100 libpng-config: 101 ( cat scripts/libpng-config-head.in; \ 102 echo prefix=\"$(prefix)\"; \ 103 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ 104 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \ 105 echo L_opts=\"-L$(LIBPATH)\"; \ 106 echo libs=\"-lpng16 -lz -lm\"; \ 107 cat scripts/libpng-config-body.in ) > libpng-config 108 chmod +x libpng-config 109 110 $(LIBSO): $(LIBSOMAJ) 111 $(LN_SF) $(LIBSOMAJ) $(LIBSO) 112 113 $(LIBSOMAJ): $(OBJSDLL) 114 $(LD) -b +s \ 115 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL) 116 117 pngtest: pngtest.o libpng.a 118 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS) 119 120 test: pngtest 121 ./pngtest 122 123 install-headers: png.h pngconf.h pnglibconf.h 124 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi 125 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi 126 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME) 127 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h 128 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h 129 -@$(RM_F) $(DI)/libpng 130 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) 131 132 install-static: install-headers libpng.a 133 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi 134 cp libpng.a $(DL)/$(LIBNAME).a 135 chmod 644 $(DL)/$(LIBNAME).a 136 -@$(RM_F) $(DL)/libpng.a 137 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) 138 139 install-shared: install-headers $(LIBSOMAJ) libpng.pc 140 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi 141 -@$(RM_F) $(DL)/$(LIBSO) 142 -@$(RM_F) $(DL)/$(LIBSOREL) 143 -@$(RM_F) $(DL)/$(OLDSO) 144 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL) 145 chmod 755 $(DL)/$(LIBSOREL) 146 (cd $(DL); \ 147 $(LN_SF) $(LIBSOREL) $(LIBSO); \ 148 $(LN_SF) $(LIBSO) $(OLDSO)) 149 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi 150 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc 151 -@$(RM_F) $(DL)/pkgconfig/libpng.pc 152 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc 153 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc 154 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) 155 156 install-man: libpng.3 libpngpf.3 png.5 157 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi 158 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi 159 -@$(RM_F) $(DM)/man3/libpng.3 160 -@$(RM_F) $(DM)/man3/libpngpf.3 161 cp libpng.3 $(DM)/man3 162 cp libpngpf.3 $(DM)/man3 163 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi 164 -@$(RM_F) $(DM)/man5/png.5 165 cp png.5 $(DM)/man5 166 167 install-config: libpng-config 168 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi 169 -@$(RM_F) $(DB)/libpng-config 170 -@$(RM_F) $(DB)/$(LIBNAME)-config 171 cp libpng-config $(DB)/$(LIBNAME)-config 172 chmod 755 $(DB)/$(LIBNAME)-config 173 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) 174 175 install: install-static install-shared install-man install-config 176 177 # If you installed in $(DESTDIR), test-installed won't work until you 178 # move the library to its final location. Use test-dd to test it 179 # before then. 180 181 test-dd: 182 echo 183 echo Testing installed dynamic shared library in $(DL). 184 $(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \ 185 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ 186 -L$(DL) -L$(ZLIBLIB) \ 187 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` 188 ./pngtestd pngtest.png 189 190 test-installed: 191 echo 192 echo Testing installed dynamic shared library. 193 $(CC) $(CPPFLAGS) $(CCFLAGS) \ 194 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ 195 -L$(ZLIBLIB) \ 196 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` 197 ./pngtesti pngtest.png 198 199 clean: 200 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \ 201 libpng-config $(LIBSO) $(LIBSOMAJ)* \ 202 libpng.pc pnglibconf.h 203 204 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO 205 writelock: 206 chmod a-w *.[ch35] $(DOCS) scripts/* 207 208 # DO NOT DELETE THIS LINE -- make depend depends on it. 209 210 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 211 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 212 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 213 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 214 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 215 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 216 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 217 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 218 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 219 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 220 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 221 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 222 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 223 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 224 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 225 226 pngtest.o: png.h pngconf.h pnglibconf.h 227