1# makefile for libpng on Solaris 2.x with cc 2# Contributed by William L. Sebok, based on makefile.linux 3# Copyright (C) 2002, 2006 Glenn Randers-Pehrson 4# Copyright (C) 1998 Greg Roelofs 5# Copyright (C) 1996, 1997 Andreas Dilger 6 7# This code is released under the libpng license. 8# For conditions of distribution and use, see the disclaimer 9# and license in png.h 10 11# Library name: 12LIBNAME=libpng12 13PNGMAJ = 0 14PNGMIN = 1.2.46 15PNGVER = $(PNGMAJ).$(PNGMIN) 16 17# Shared library names: 18LIBSO=$(LIBNAME).so 19LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) 20LIBSOVER=$(LIBNAME).so.$(PNGVER) 21OLDSO=libpng.so 22OLDSOMAJ=libpng.so.3 23OLDSOVER=libpng.so.3.$(PNGMIN) 24 25# Utilities: 26CC=cc 27AR_RC=ar rc 28MKDIR_P=mkdir -p 29LN_SF=ln -f -s 30RANLIB=echo 31RM_F=/bin/rm -f 32 33SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9 34SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9 35 36# where make install puts libpng.a, libpng12.so and libpng12/png.h 37prefix=/a 38exec_prefix=$(prefix) 39 40# Where the zlib library and include files are located 41# Changing these to ../zlib poses a security risk. If you want 42# to have zlib in an adjacent directory, specify the full path instead of "..". 43#ZLIBLIB=../zlib 44#ZLIBINC=../zlib 45 46ZLIBLIB=/usr/lib 47ZLIBINC=/usr/include 48 49WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ 50 -Wmissing-declarations -Wtraditional -Wcast-align \ 51 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion 52CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \ 53 # $(WARNMORE) -g -DPNG_DEBUG=5 54LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm 55 56INCPATH=$(prefix)/include 57LIBPATH=$(exec_prefix)/lib 58MANPATH=$(prefix)/man 59BINPATH=$(exec_prefix)/bin 60 61# override DESTDIR= on the make install command line to easily support 62# installing into a temporary location. Example: 63# 64# make install DESTDIR=/tmp/build/libpng 65# 66# If you're going to install into a temporary location 67# via DESTDIR, $(DESTDIR)$(prefix) must already exist before 68# you execute make install. 69DESTDIR= 70 71DB=$(DESTDIR)$(BINPATH) 72DI=$(DESTDIR)$(INCPATH) 73DL=$(DESTDIR)$(LIBPATH) 74DM=$(DESTDIR)$(MANPATH) 75 76OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ 77 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ 78 pngwtran.o pngmem.o pngerror.o pngpread.o 79 80OBJSDLL = $(OBJS:.o=.pic.o) 81 82.SUFFIXES: .c .o .pic.o 83 84.c.pic.o: 85 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c 86 87all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config 88 89libpng.a: $(OBJS) 90 $(AR_RC) $@ $(OBJS) 91 $(RANLIB) $@ 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!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc 99 100libpng-config: 101 ( cat scripts/libpng-config-head.in; \ 102 echo prefix=\"$(prefix)\"; \ 103 echo libdir=\"$(LIBPATH)\"; \ 104 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ 105 echo L_opts=\"-L$(LIBPATH)\"; \ 106 echo R_opts=\"-R$(LIBPATH)\"; \ 107 echo ccopts=\"-xtarget=ultra -xarch=v9\"; \ 108 echo ldopts=\"-xtarget=ultra -xarch=v9\"; \ 109 echo libs=\"-lpng12 -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): $(LIBSOVER) 117 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ) 118 119$(LIBSOVER): $(OBJSDLL) 120 @case "`type ld`" in *ucb*) \ 121 echo; \ 122 echo '## WARNING:'; \ 123 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \ 124 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \ 125 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \ 126 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \ 127 echo '## at all. If it is, things are likely to break because of'; \ 128 echo '## the libucb dependency that is created.'; \ 129 echo; \ 130 ;; \ 131 esac 132 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBSOMAJ) \ 133 -o $(LIBSOVER) $(OBJSDLL) 134 135$(OLDSOVER): $(OBJSDLL) 136 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(OLDSOMAJ) \ 137 -o $(OLDSOVER) $(OBJSDLL) 138 139pngtest: pngtest.o $(LIBSO) 140 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) 141 142test: pngtest 143 ./pngtest 144 145install-headers: png.h pngconf.h 146 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi 147 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi 148 cp png.h pngconf.h $(DI)/$(LIBNAME) 149 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h 150 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h 151 -@$(RM_F) $(DI)/libpng 152 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) 153 154install-static: install-headers libpng.a 155 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi 156 cp libpng.a $(DL)/$(LIBNAME).a 157 chmod 644 $(DL)/$(LIBNAME).a 158 -@$(RM_F) $(DL)/libpng.a 159 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) 160 161install-shared: install-headers $(LIBSOVER) libpng.pc \ 162 $(OLDSOVER) 163 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi 164 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO) 165 -@$(RM_F) $(DL)/$(LIBSOMAJ) 166 -@$(RM_F) $(DL)/$(LIBSO) 167 -@$(RM_F) $(DL)/$(OLDSO) 168 -@$(RM_F) $(DL)/$(OLDSOMAJ) 169 -@$(RM_F) $(DL)/$(OLDSOMAJ).$(PNGVER)* 170 cp $(LIBSOVER) $(DL) 171 cp $(OLDSOVER) $(DL) 172 chmod 755 $(DL)/$(LIBSOVER) 173 chmod 755 $(DL)/$(OLDSOVER) 174 (cd $(DL); \ 175 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \ 176 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \ 177 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \ 178 $(LN_SF) $(LIBSOMAJ) $(LIBSO)) 179 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi 180 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc 181 -@$(RM_F) $(DL)/pkgconfig/libpng.pc 182 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc 183 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc 184 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) 185 186install-man: libpng.3 libpngpf.3 png.5 187 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi 188 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi 189 -@$(RM_F) $(DM)/man3/libpng.3 190 -@$(RM_F) $(DM)/man3/libpngpf.3 191 cp libpng.3 $(DM)/man3 192 cp libpngpf.3 $(DM)/man3 193 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi 194 -@$(RM_F) $(DM)/man5/png.5 195 cp png.5 $(DM)/man5 196 197install-config: libpng-config 198 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi 199 -@$(RM_F) $(DB)/libpng-config 200 -@$(RM_F) $(DB)/$(LIBNAME)-config 201 cp libpng-config $(DB)/$(LIBNAME)-config 202 chmod 755 $(DB)/$(LIBNAME)-config 203 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) 204 205install: install-static install-shared install-man install-config 206 207# If you installed in $(DESTDIR), test-installed won't work until you 208# move the library to its final location. Use test-dd to test it 209# before then. 210 211test-dd: 212 echo 213 echo Testing installed dynamic shared library in $(DL). 214 $(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \ 215 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ 216 -o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \ 217 $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) 218 ./pngtestd pngtest.png 219 220test-installed: 221 echo 222 echo Testing installed dynamic shared library. 223 $(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \ 224 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ 225 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \ 226 $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) 227 ./pngtesti pngtest.png 228 229clean: 230 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \ 231 libpng-config $(LIBSO) $(LIBSOMAJ)* \ 232 $(OLDSOVER) \ 233 libpng.pc 234 235DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO 236writelock: 237 chmod a-w *.[ch35] $(DOCS) scripts/* 238 239# DO NOT DELETE THIS LINE -- make depend depends on it. 240 241png.o png.pic.o: png.h pngconf.h 242pngerror.o pngerror.pic.o: png.h pngconf.h 243pngrio.o pngrio.pic.o: png.h pngconf.h 244pngwio.o pngwio.pic.o: png.h pngconf.h 245pngmem.o pngmem.pic.o: png.h pngconf.h 246pngset.o pngset.pic.o: png.h pngconf.h 247pngget.o pngget.pic.o: png.h pngconf.h 248pngread.o pngread.pic.o: png.h pngconf.h 249pngrtran.o pngrtran.pic.o: png.h pngconf.h 250pngrutil.o pngrutil.pic.o: png.h pngconf.h 251pngtrans.o pngtrans.pic.o: png.h pngconf.h 252pngwrite.o pngwrite.pic.o: png.h pngconf.h 253pngwtran.o pngwtran.pic.o: png.h pngconf.h 254pngwutil.o pngwutil.pic.o: png.h pngconf.h 255pngpread.o pngpread.pic.o: png.h pngconf.h 256 257pngtest.o: png.h pngconf.h 258