1# makefile for libpng on BeOS x86 ELF with gcc 2# modified from makefile.linux by Sander Stoks 3# Copyright (C) 2002 Glenn Randers-Pehrson 4# Copyright (C) 1999 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 the zlib library and include files are located 11ZLIBLIB=/usr/local/lib 12ZLIBINC=/usr/local/include 13 14PNGMAJ = 0 15PNGMIN = 1.2.7 16PNGVER = $(PNGMAJ).$(PNGMIN) 17 18ALIGN= 19# For i386: 20# ALIGN=-malign-loops=2 -malign-functions=2 21 22WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ 23 -Wmissing-declarations -Wtraditional -Wcast-align \ 24 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion 25 26# On BeOS, -O1 is actually better than -O3. This is a known bug but it's 27# still here in R4.5 28CFLAGS=-I$(ZLIBINC) -Wall -O1 -funroll-loops \ 29 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 30# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm 31LDFLAGS=-L. -Wl,-soname=$(LIBNAME).so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm 32 33RANLIB=ranlib 34#RANLIB=echo 35 36# where make install puts libpng.a, libpng12.so*, and png.h 37prefix=/usr/local 38INCPATH=$(prefix)/include 39LIBPATH=$(prefix)/lib 40MANPATH=$(prefix)/man 41BINPATH=$(prefix)/bin 42 43# override DESTDIR= on the make install command line to easily support 44# installing into a temporary location. Example: 45# 46# make install DESTDIR=/tmp/build/libpng 47# 48# If you're going to install into a temporary location 49# via DESTDIR, $(DESTDIR)$(prefix) must already exist before 50# you execute make install. 51DESTDIR= 52 53DB=$(DESTDIR)$(BINPATH) 54DI=$(DESTDIR)$(INCPATH) 55DL=$(DESTDIR)$(LIBPATH) 56DM=$(DESTDIR)$(MANPATH) 57 58LIBNAME=libpng12 59 60OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ 61 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ 62 pngwtran.o pngmem.o pngerror.o pngpread.o 63 64OBJSDLL = $(OBJS) 65 66.SUFFIXES: .c .o 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 libs=\"-lpng12 -lz -lm\"; \ 82 cat scripts/libpng-config-body.in ) > libpng-config 83 chmod +x libpng-config 84 85$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) 86 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so 87 cp $(LIBNAME).so* /boot/home/config/lib 88 89$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) 90 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) 91 92$(LIBNAME).so.$(PNGVER): $(OBJSDLL) 93 $(CC) -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o \ 94 $(LIBNAME).so.$(PNGVER) $(OBJSDLL) 95 96libpng.so.3.$(PNGMIN): $(OBJSDLL) 97 $(CC) -nostart -Wl,-soname,libpng.so.3 -o \ 98 libpng.so.3.$(PNGMIN) $(OBJSDLL) 99 100pngtest: pngtest.o $(LIBNAME).so 101 $(CC) -L$(ZLIBLIB) -lz -lpng12 -o pngtest pngtest.o 102 103test: pngtest 104 ./pngtest 105 106install-headers: png.h pngconf.h 107 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi 108 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi 109 cp png.h pngconf.h $(DI)/$(LIBNAME) 110 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h 111 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h 112 -@/bin/rm -f $(DI)/libpng 113 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .) 114 115install-static: install-headers libpng.a 116 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi 117 cp libpng.a $(DL)/$(LIBNAME).a 118 chmod 644 $(DL)/$(LIBNAME).a 119 -@/bin/rm -f $(DL)/libpng.a 120 (cd $(DL); ln -sf $(LIBNAME).a libpng.a) 121 122install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \ 123 libpng.so.3.$(PNGMIN) 124 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi 125 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so 126 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ) 127 -@/bin/rm -f $(DL)/libpng.so 128 -@/bin/rm -f $(DL)/libpng.so.3 129 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)* 130 cp $(LIBNAME).so.$(PNGVER) $(DL) 131 cp libpng.so.3.$(PNGMIN) $(DL) 132 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) 133 chmod 755 $(DL)/libpng.so.3.$(PNGMIN) 134 (cd $(DL); \ 135 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \ 136 ln -sf libpng.so.3 libpng.so; \ 137 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ 138 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) 139 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi 140 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc 141 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc 142 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc 143 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc 144 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) 145 146install-man: libpng.3 libpngpf.3 png.5 147 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi 148 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi 149 -@/bin/rm -f $(DM)/man3/libpng.3 150 -@/bin/rm -f $(DM)/man3/libpngpf.3 151 cp libpng.3 $(DM)/man3 152 cp libpngpf.3 $(DM)/man3 153 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi 154 -@/bin/rm -f $(DM)/man5/png.5 155 cp png.5 $(DM)/man5 156 157install-config: libpng-config 158 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi 159 -@/bin/rm -f $(DB)/libpng-config 160 -@/bin/rm -f $(DB)/$(LIBNAME)-config 161 cp libpng-config $(DB)/$(LIBNAME)-config 162 chmod 755 $(DB)/$(LIBNAME)-config 163 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) 164 165install: install-static install-shared install-man install-config 166 167# If you installed in $(DESTDIR), test-installed won't work until you 168# move the library to its final location. Use test-dd to test it 169# before then. 170 171test-dd: 172 echo 173 echo Testing installed dynamic shared library in $(DL). 174 $(CC) -I$(DI) $(CFLAGS) \ 175 `$(BINPATH)/libpng12-config --cflags` pngtest.c \ 176 -L$(DL) -L$(ZLIBLIB) -W1,-rpath $(ZLIBLIB):$(DL) \ 177 -o pngtestd `$(BINPATH)/libpng12-config --ldflags` 178 ./pngtestd pngtest.png 179 180test-installed: 181 $(CC) $(CFLAGS) \ 182 `$(BINPATH)/libpng12-config --cflags` pngtest.c \ 183 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ 184 -o pngtesti `$(BINPATH)/libpng12-config --ldflags` 185 ./pngtesti pngtest.png 186 187clean: 188 /bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \ 189 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti \ 190 libpng.so.3.$(PNGMIN) \ 191 libpng.pc 192 193# DO NOT DELETE THIS LINE -- make depend depends on it. 194 195png.o png.pic.o: png.h pngconf.h 196pngerror.o pngerror.pic.o: png.h pngconf.h 197pngrio.o pngrio.pic.o: png.h pngconf.h 198pngwio.o pngwio.pic.o: png.h pngconf.h 199pngmem.o pngmem.pic.o: png.h pngconf.h 200pngset.o pngset.pic.o: png.h pngconf.h 201pngget.o pngget.pic.o: png.h pngconf.h 202pngread.o pngread.pic.o: png.h pngconf.h 203pngrtran.o pngrtran.pic.o: png.h pngconf.h 204pngrutil.o pngrutil.pic.o: png.h pngconf.h 205pngtrans.o pngtrans.pic.o: png.h pngconf.h 206pngwrite.o pngwrite.pic.o: png.h pngconf.h 207pngwtran.o pngwtran.pic.o: png.h pngconf.h 208pngwutil.o pngwutil.pic.o: png.h pngconf.h 209pngpread.o pngpread.pic.o: png.h pngconf.h 210pngtest.o: png.h pngconf.h 211