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