Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 1 | # makefile for libpng on BeOS x86 ELF with gcc |
Glenn Randers-Pehrson | bcfd15d | 1999-10-01 14:22:25 -0500 | [diff] [blame] | 2 | # modified from makefile.linux by Sander Stoks |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 3 | # Copyright (C) 2002 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 98c9d73 | 2000-05-03 21:06:11 -0500 | [diff] [blame] | 4 | # Copyright (C) 1999 Greg Roelofs |
Glenn Randers-Pehrson | d436672 | 2000-06-04 14:29:29 -0500 | [diff] [blame] | 5 | # Copyright (C) 1996, 1997 Andreas Dilger |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 6 | # For conditions of distribution and use, see copyright notice in png.h |
| 7 | |
| 8 | CC=gcc |
| 9 | |
| 10 | # Where the zlib library and include files are located |
| 11 | ZLIBLIB=/usr/local/lib |
| 12 | ZLIBINC=/usr/local/include |
| 13 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 14 | PNGMAJ = 0 |
Glenn Randers-Pehrson | 2ae022d | 2002-07-01 22:23:46 -0500 | [diff] [blame^] | 15 | PNGMIN = 1.2.4rc1 |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 16 | PNGVER = $(PNGMAJ).$(PNGMIN) |
| 17 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 18 | ALIGN= |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 19 | # For i386: |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 20 | # ALIGN=-malign-loops=2 -malign-functions=2 |
| 21 | |
| 22 | WARNMORE=-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 |
| 28 | CFLAGS=-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 |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 31 | LDFLAGS=-L. -Wl,-soname=$(LIBNAME).so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 32 | |
| 33 | RANLIB=ranlib |
| 34 | #RANLIB=echo |
| 35 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 36 | # where make install puts libpng.a, libpng12.so*, and png.h |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 37 | prefix=/usr/local |
| 38 | INCPATH=$(prefix)/include |
| 39 | LIBPATH=$(prefix)/lib |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 40 | MANPATH=$(prefix)/man |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 41 | BINPATH=$(prefix)/bin |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 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 |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 49 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 50 | # you execute make install. |
| 51 | DESTDIR= |
| 52 | |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 53 | DB=$(DESTDIR)$(BINPATH) |
| 54 | DI=$(DESTDIR)$(INCPATH) |
| 55 | DL=$(DESTDIR)$(LIBPATH) |
| 56 | DM=$(DESTDIR)$(MANPATH) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 57 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 58 | LIBNAME=libpng12 |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 59 | |
| 60 | OBJS = 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 | |
| 64 | OBJSDLL = $(OBJS) |
| 65 | |
| 66 | .SUFFIXES: .c .o |
| 67 | |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 68 | all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 69 | |
| 70 | libpng.a: $(OBJS) |
| 71 | ar rc $@ $(OBJS) |
| 72 | $(RANLIB) $@ |
| 73 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 74 | libpng.pc: |
| 75 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc |
| 76 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 77 | libpng-config: |
| 78 | ( cat scripts/libpng-config-head.in; \ |
| 79 | echo prefix=\"$(prefix)\"; \ |
Glenn Randers-Pehrson | 22f2896 | 2002-05-13 18:17:09 -0500 | [diff] [blame] | 80 | echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \ |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 81 | echo cflags=\"\"; \ |
Glenn Randers-Pehrson | 22f2896 | 2002-05-13 18:17:09 -0500 | [diff] [blame] | 82 | echo ldflags=\"-Wl,-soname=$(LIBNAME).so.$(PNGMAJ)\"; \ |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 83 | echo libs=\"-lpng12 -lz -lm\"; \ |
| 84 | cat scripts/libpng-config-body.in ) > libpng-config |
| 85 | chmod +x libpng-config |
| 86 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 87 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) |
| 88 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so |
| 89 | cp $(LIBNAME).so* /boot/home/config/lib |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 90 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 91 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) |
| 92 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 93 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 94 | $(LIBNAME).so.$(PNGVER): $(OBJSDLL) |
| 95 | $(CC) -L$(ZLIBLIB) -lz -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o |
| 96 | $(LIBNAME).so.$(PNGVER) \ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 97 | $(OBJSDLL) |
| 98 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 99 | pngtest: pngtest.o $(LIBNAME).so |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 100 | $(CC) -L$(ZLIBLIB) -lz -lpng12 -o pngtest pngtest.o |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 101 | |
| 102 | test: pngtest |
| 103 | ./pngtest |
| 104 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 105 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 106 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi |
| 107 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi |
| 108 | cp png.h pngconf.h $(DI)/$(LIBNAME) |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 109 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 110 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h |
| 111 | -@/bin/rm -f $(DI)/libpng |
| 112 | (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 113 | |
| 114 | install-static: install-headers libpng.a |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 115 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
| 116 | cp libpng.a $(DL)/$(LIBNAME).a |
| 117 | chmod 644 $(DL)/$(LIBNAME).a |
| 118 | -@/bin/rm -f $(DL)/libpng.a |
| 119 | (cd $(DL); ln -sf $(LIBNAME).a libpng.a) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 120 | |
Glenn Randers-Pehrson | 25d8224 | 2002-05-01 11:51:26 -0500 | [diff] [blame] | 121 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 122 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 123 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 124 | -@/bin/rm -f $(DL)/libpng.so |
| 125 | -@/bin/rm -f $(DL)/libpng.so.3 |
| 126 | -@/bin/rm -f $(DL)/libpng.so.3.* |
| 127 | cp $(LIBNAME).so.$(PNGVER) $(DL) |
| 128 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) |
| 129 | (cd $(DL); \ |
Glenn Randers-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 130 | ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ |
| 131 | ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \ |
| 132 | ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \ |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 133 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ |
| 134 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 135 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi |
| 136 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc |
| 137 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc |
| 138 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc |
| 139 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc |
| 140 | (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 141 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 142 | install-man: libpng.3 libpngpf.3 png.5 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 143 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi |
| 144 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi |
| 145 | -@/bin/rm -f $(DM)/man3/libpng.3 |
| 146 | -@/bin/rm -f $(DM)/man3/libpngpf.3 |
| 147 | cp libpng.3 $(DM)/man3 |
| 148 | cp libpngpf.3 $(DM)/man3 |
| 149 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi |
| 150 | -@/bin/rm -f $(DM)/man5/png.5 |
| 151 | cp png.5 $(DM)/man5 |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 152 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 153 | install-config: libpng-config |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 154 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi |
| 155 | -@/bin/rm -f $(DB)/libpng-config |
| 156 | -@/bin/rm -f $(DB)/$(LIBNAME)-config |
| 157 | cp libpng-config $(DB)/$(LIBNAME)-config |
| 158 | chmod 755 $(DB)/$(LIBNAME)-config |
| 159 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 160 | |
| 161 | install: install-static install-shared install-man install-config |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 162 | |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 163 | # If you installed in $(DESTDIR), test-installed won't work until you |
| 164 | # move the library to its final location. |
| 165 | |
| 166 | test-installed: |
| 167 | $(CC) $(CFLAGS) \ |
| 168 | `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \ |
| 169 | -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ |
| 170 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` |
Glenn Randers-Pehrson | 2ae022d | 2002-07-01 22:23:46 -0500 | [diff] [blame^] | 171 | ./pngtesti pngtest.png |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 172 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 173 | clean: |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 174 | /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \ |
| 175 | $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 176 | |
| 177 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 178 | |
| 179 | png.o png.pic.o: png.h pngconf.h |
| 180 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 181 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 182 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 183 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 184 | pngset.o pngset.pic.o: png.h pngconf.h |
| 185 | pngget.o pngget.pic.o: png.h pngconf.h |
| 186 | pngread.o pngread.pic.o: png.h pngconf.h |
| 187 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 188 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 189 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 190 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 191 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 192 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 193 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 194 | pngtest.o: png.h pngconf.h |