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