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