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