Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 1 | # makefile for libpng on Darwin / Mac OS X |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 2 | # Copyright (C) 2002 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 3 | # Copyright (C) 2001 Christoph Pfisterer |
| 4 | # derived from makefile.linux: |
| 5 | # Copyright (C) 1998, 1999 Greg Roelofs |
| 6 | # Copyright (C) 1996, 1997 Andreas Dilger |
| 7 | # For conditions of distribution and use, see copyright notice in png.h |
| 8 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 9 | # where "make install" puts libpng.a, libpng12.dylib, png.h and pngconf.h |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 10 | prefix=/usr/local |
| 11 | |
| 12 | # Where the zlib library and include files are located |
| 13 | #ZLIBLIB=/usr/local/lib |
| 14 | #ZLIBINC=/usr/local/include |
| 15 | ZLIBLIB=../zlib |
| 16 | ZLIBINC=../zlib |
| 17 | |
| 18 | CC=cc |
| 19 | CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 20 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 21 | |
| 22 | #RANLIB=echo |
| 23 | RANLIB=ranlib |
| 24 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 25 | PNGMAJ = 0 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 26 | PNGMIN = 1.2.3 |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 27 | PNGVER = $(PNGMAJ).$(PNGMIN) |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 28 | LIBNAME = libpng12 |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 29 | |
| 30 | INCPATH=$(prefix)/include |
| 31 | LIBPATH=$(prefix)/lib |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 32 | MANPATH=$(prefix)/man |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 33 | BINPATH=$(prefix)/bin |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 34 | |
| 35 | # override DESTDIR= on the make install command line to easily support |
| 36 | # installing into a temporary location. Example: |
| 37 | # |
| 38 | # make install DESTDIR=/tmp/build/libpng |
| 39 | # |
| 40 | # If you're going to install into a temporary location |
| 41 | # via DESTDIR, that location must already exist before |
| 42 | # you execute make install. |
| 43 | DESTDIR= |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 44 | |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 45 | DB=$(DESTDIR)/$(BINPATH) |
| 46 | DI=$(DESTDIR)/$(INCPATH) |
| 47 | DL=$(DESTDIR)/$(LIBPATH) |
| 48 | DM=$(DESTDIR)/$(MANPATH) |
| 49 | |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 50 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
| 51 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 52 | pngwtran.o pngmem.o pngerror.o pngpread.o |
| 53 | |
| 54 | OBJSDLL = $(OBJS:.o=.pic.o) |
| 55 | |
| 56 | .SUFFIXES: .c .o .pic.o |
| 57 | |
| 58 | .c.pic.o: |
| 59 | $(CC) -c $(CFLAGS) -fno-common -o $@ $*.c |
| 60 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 61 | all: libpng.a $(LIBNAME).dylib pngtest |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 62 | |
| 63 | libpng.a: $(OBJS) |
| 64 | ar rc $@ $(OBJS) |
| 65 | $(RANLIB) $@ |
| 66 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 67 | libpng.pc: |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 68 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ |
| 69 | sed -e s/-lm// > libpng.pc |
| 70 | |
| 71 | libpng-config: |
| 72 | ( cat scripts/libpng-config-head.in; \ |
| 73 | echo prefix=\"$(prefix)\"; \ |
Glenn Randers-Pehrson | 22f2896 | 2002-05-13 18:17:09 -0500 | [diff] [blame] | 74 | echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \ |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 75 | echo cflags=\"\"; \ |
| 76 | echo ldflags=\"-L$(LIBPATH)\"; \ |
| 77 | echo libs=\"-lpng12 -lz\"; \ |
| 78 | cat scripts/libpng-config-body.in ) > libpng-config |
| 79 | chmod +x libpng-config |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 80 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 81 | $(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib |
| 82 | ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 83 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 84 | $(LIBNAME).$(PNGMAJ).dylib: $(LIBNAME).$(PNGVER).dylib |
| 85 | ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 86 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 87 | $(LIBNAME).$(PNGVER).dylib: $(OBJSDLL) |
| 88 | $(CC) -dynamiclib \ |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 89 | -install_name $(DL)/$(LIBNAME).$(PNGMAJ).dylib \ |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 90 | -current_version $(PNGMIN) -compatibility_version $(PNGMIN) \ |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 91 | -o $(LIBNAME).$(PNGVER).dylib \ |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 92 | $(OBJSDLL) -L$(ZLIBLIB) -lz |
| 93 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 94 | pngtest: pngtest.o $(LIBNAME).dylib |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 95 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 96 | |
| 97 | test: pngtest |
| 98 | ./pngtest |
| 99 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 100 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 101 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi |
| 102 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi |
| 103 | cp png.h pngconf.h $(DI)/$(LIBNAME) |
| 104 | chmod 644 $(DI)/$(LIBNAME)/png.h \ |
| 105 | $(DI)/$(LIBNAME)/pngconf.h |
| 106 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h |
| 107 | -@/bin/rm -f $(DI)/libpng |
| 108 | (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 109 | |
| 110 | install-static: install-headers libpng.a |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 111 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
| 112 | cp libpng.a $(DL)/$(LIBNAME).a |
| 113 | chmod 644 $(DL)/$(LIBNAME).a |
| 114 | -@/bin/rm -f $(DL)/libpng.a |
| 115 | (cd $(DL); ln -sf $(LIBNAME).a libpng.a) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 116 | |
Glenn Randers-Pehrson | 25d8224 | 2002-05-01 11:51:26 -0500 | [diff] [blame] | 117 | install-shared: install-headers $(LIBNAME).dylib libpng.pc |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 118 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
| 119 | -@/bin/rm -f $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib |
| 120 | -@/bin/rm -f $(DL)/$(LIBNAME).dylib |
| 121 | -@/bin/rm -f $(DL)/libpng.dylib |
| 122 | -@/bin/rm -f $(DL)/libpng.3.dylib |
| 123 | -@/bin/rm -f $(DL)/libpng.3.*.dylib |
| 124 | cp $(LIBNAME).$(PNGVER).dylib $(DL) |
| 125 | chmod 755 $(DL)/$(LIBNAME).$(PNGVER).dylib |
| 126 | (cd $(DL); \ |
Glenn Randers-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 127 | ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \ |
| 128 | ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.dylib; \ |
| 129 | ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.$(PNGMIN).dylib; \ |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 130 | ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \ |
| 131 | ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 132 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi |
| 133 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc |
| 134 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc |
| 135 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc |
| 136 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc |
| 137 | (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 138 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 139 | install-man: libpng.3 libpngpf.3 png.5 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 140 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi |
| 141 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi |
| 142 | -@/bin/rm -f $(DM)/man3/libpng.3 |
| 143 | -@/bin/rm -f $(DM)/man3/libpngpf.3 |
| 144 | cp libpng.3 $(DM)/man3 |
| 145 | cp libpngpf.3 $(DM)/man3 |
| 146 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi |
| 147 | -@/bin/rm -f $(DM)/man5/png.5 |
| 148 | cp png.5 $(DM)/man5 |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 149 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 150 | install-config: libpng-config |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame^] | 151 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi |
| 152 | -@/bin/rm -f $(DB)/libpng-config |
| 153 | -@/bin/rm -f $(DB)/$(LIBNAME)-config |
| 154 | cp libpng-config $(DB)/$(LIBNAME)-config |
| 155 | chmod 755 $(DB)/$(LIBNAME)-config |
| 156 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 157 | |
| 158 | install: install-static install-shared install-man install-config |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 159 | |
| 160 | clean: |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 161 | rm -f *.o libpng.a $(LIBNAME).*dylib pngtest pngout.png |
Glenn Randers-Pehrson | 5a0be34 | 2001-10-18 20:55:13 -0500 | [diff] [blame] | 162 | |
| 163 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 164 | writelock: |
| 165 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 166 | |
| 167 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 168 | |
| 169 | png.o png.pic.o: png.h pngconf.h |
| 170 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 171 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 172 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 173 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 174 | pngset.o pngset.pic.o: png.h pngconf.h |
| 175 | pngget.o pngget.pic.o: png.h pngconf.h |
| 176 | pngread.o pngread.pic.o: png.h pngconf.h |
| 177 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 178 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 179 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 180 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 181 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 182 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 183 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 184 | |
| 185 | pngtest.o: png.h pngconf.h |