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