1 # makefile for libpng on BeOS x86 ELF with gcc 2 # modified from makefile.linux by Sander Stoks 3 # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson 4 # Copyright (C) 1999 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: 12 LIBNAME=libpng16 13 PNGMAJ = 16 14 15 # Shared library names: 16 LIBSO=$(LIBNAME).so 17 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) 18 LIBSOREL=$(LIBSOMAJ).$(RELEASE) 19 OLDSO=libpng.so 20 21 # Utilities: 22 CC=gcc 23 AR_RC=ar rc 24 MKDIR_P=mkdir -p 25 LN_SF=ln -sf 26 RANLIB=ranlib 27 RM_F=/bin/rm -f 28 29 # Where the zlib library and include files are located 30 ZLIBLIB=/usr/local/lib 31 ZLIBINC=/usr/local/include 32 33 ALIGN= 34 # For i386: 35 # ALIGN=-malign-loops=2 -malign-functions=2 36 37 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ 38 -Wmissing-declarations -Wtraditional -Wcast-align \ 39 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion 40 41 # On BeOS, -O1 is actually better than -O3. This is a known bug but it's 42 # still here in R4.5 43 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 44 CFLAGS=-W -Wall -O1 -funroll-loops $(ALIGN) # $(WARNMORE) -g 45 # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz 46 LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz 47 48 # where make install puts libpng.a, libpng16.so*, and png.h 49 prefix=/usr/local 50 exec_prefix=$(prefix) 51 INCPATH=$(prefix)/include 52 LIBPATH=$(exec_prefix)/lib 53 MANPATH=$(prefix)/man 54 BINPATH=$(exec_prefix)/bin 55 56 # override DESTDIR= on the make install command line to easily support 57 # installing into a temporary location. Example: 58 # 59 # make install DESTDIR=/tmp/build/libpng 60 # 61 # If you're going to install into a temporary location 62 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before 63 # you execute make install. 64 DESTDIR= 65 66 DB=$(DESTDIR)$(BINPATH) 67 DI=$(DESTDIR)$(INCPATH) 68 DL=$(DESTDIR)$(LIBPATH) 69 DM=$(DESTDIR)$(MANPATH) 70 71 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ 72 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ 73 pngwtran.o pngmem.o pngerror.o pngpread.o 74 75 OBJSDLL = $(OBJS) 76 77 .SUFFIXES: .c .o 78 79 .c.o: 80 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 81 82 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config 83 84 # try include scripts/pnglibconf.mak for more options 85 pnglibconf.h: scripts/pnglibconf.h.prebuilt 86 cp scripts/pnglibconf.h.prebuilt $@ 87 88 libpng.a: $(OBJS) 89 $(AR_RC) $@ $(OBJS) 90 $(RANLIB) $@ 91 92 libpng.pc: 93 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ 94 -e s!@exec_prefix@!$(exec_prefix)! \ 95 -e s!@libdir@!$(LIBPATH)! \ 96 -e s!@includedir@!$(INCPATH)! \ 97 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc 98 99 libpng-config: 100 ( cat scripts/libpng-config-head.in; \ 101 echo prefix=\"$(prefix)\"; \ 102 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ 103 echo libs=\"-lpng16 -lz \"; \ 104 cat scripts/libpng-config-body.in ) > libpng-config 105 chmod +x libpng-config 106 107 $(LIBSO): $(LIBSOMAJ) 108 $(LN_SF) $(LIBSOMAJ) $(LIBSO) 109 cp $(LIBSO)* /boot/home/config/lib 110 111 $(LIBSOMAJ): $(OBJSDLL) 112 $(CC) -nostart -Wl,-soname,$(LIBSOMAJ) -o \ 113 $(LIBSOMAJ) $(OBJSDLL) $(LDFLAGS) 114 115 pngtest: pngtest.o $(LIBSO) 116 $(CC) -L$(ZLIBLIB) -L. -lz -lpng16 -o pngtest pngtest.o 117 118 test: pngtest 119 ./pngtest 120 121 install-headers: png.h pngconf.h pnglibconf.h 122 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi 123 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi 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) $(CFLAGS) \ 183 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ 184 -L$(DL) -L$(ZLIBLIB) -Wl,-rpath $(ZLIBLIB):$(DL) \ 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) -Wl,-rpath,$(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)* pngtesti \ 198 pnglibconf.h libpng.pc 199 200 # DO NOT DELETE THIS LINE -- make depend depends on it. 201 202 png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 203 pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 204 pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 205 pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 206 pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 207 pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 208 pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 209 pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 210 pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 211 pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 212 pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 213 pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 214 pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 215 pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 216 pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 217 218 pngtest.o: png.h pngconf.h pnglibconf.h 219