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