| 1 | # makefile for libpng on Darwin / Mac OS X
 | 
|---|
| 2 | # Copyright (C) 2002 Glenn Randers-Pehrson
 | 
|---|
| 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 | 
 | 
|---|
| 9 | # where "make install" puts libpng.a, libpng12.dylib, png.h and pngconf.h
 | 
|---|
| 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
 | 
|---|
| 20 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
 | 
|---|
| 21 | 
 | 
|---|
| 22 | #RANLIB=echo
 | 
|---|
| 23 | RANLIB=ranlib
 | 
|---|
| 24 | 
 | 
|---|
| 25 | PNGMAJ = 0
 | 
|---|
| 26 | PNGMIN = 1.2.5
 | 
|---|
| 27 | PNGVER = $(PNGMAJ).$(PNGMIN)
 | 
|---|
| 28 | LIBNAME = libpng12
 | 
|---|
| 29 | 
 | 
|---|
| 30 | INCPATH=$(prefix)/include
 | 
|---|
| 31 | LIBPATH=$(prefix)/lib
 | 
|---|
| 32 | MANPATH=$(prefix)/man
 | 
|---|
| 33 | BINPATH=$(prefix)/bin
 | 
|---|
| 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, $(DESTDIR)$(prefix) must already exist before
 | 
|---|
| 42 | # you execute make install.
 | 
|---|
| 43 | DESTDIR=
 | 
|---|
| 44 | 
 | 
|---|
| 45 | DB=$(DESTDIR)$(BINPATH)
 | 
|---|
| 46 | DI=$(DESTDIR)$(INCPATH)
 | 
|---|
| 47 | DL=$(DESTDIR)$(LIBPATH)
 | 
|---|
| 48 | DM=$(DESTDIR)$(MANPATH)
 | 
|---|
| 49 | 
 | 
|---|
| 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 | 
 | 
|---|
| 61 | all: libpng.a $(LIBNAME).dylib pngtest libpng.pc libpng-config
 | 
|---|
| 62 | 
 | 
|---|
| 63 | libpng.a: $(OBJS)
 | 
|---|
| 64 |         ar rc $@ $(OBJS)
 | 
|---|
| 65 |         $(RANLIB) $@
 | 
|---|
| 66 | 
 | 
|---|
| 67 | libpng.pc:
 | 
|---|
| 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)\"; \
 | 
|---|
| 74 |         echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
 | 
|---|
| 75 |         echo L_opts=\"-L$(LIBPATH)\"; \
 | 
|---|
| 76 |         echo libs=\"-lpng12 -lz\"; \
 | 
|---|
| 77 |         cat scripts/libpng-config-body.in ) > libpng-config
 | 
|---|
| 78 |         chmod +x libpng-config
 | 
|---|
| 79 | 
 | 
|---|
| 80 | $(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib
 | 
|---|
| 81 |         ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
 | 
|---|
| 82 | 
 | 
|---|
| 83 | $(LIBNAME).$(PNGMAJ).dylib: $(LIBNAME).$(PNGVER).dylib
 | 
|---|
| 84 |         ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib
 | 
|---|
| 85 | 
 | 
|---|
| 86 | $(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
 | 
|---|
| 87 |         $(CC) -dynamiclib \
 | 
|---|
| 88 |          -install_name $(DL)/$(LIBNAME).$(PNGMAJ).dylib \
 | 
|---|
| 89 |          -flat_namespace -undefined suppress \
 | 
|---|
| 90 |          -o $(LIBNAME).$(PNGVER).dylib \
 | 
|---|
| 91 |          $(OBJSDLL)
 | 
|---|
| 92 | 
 | 
|---|
| 93 | libpng.3.$(PNGMIN).dylib: $(OBJSDLL)
 | 
|---|
| 94 |         $(CC) -dynamiclib \
 | 
|---|
| 95 |          -install_name $(DL)/libpng.3.dylib \
 | 
|---|
| 96 |          -current_version 3 -compatibility_version 3 \
 | 
|---|
| 97 |          -flat_namespace -undefined suppress \
 | 
|---|
| 98 |          -o libpng.3.$(PNGMIN).dylib \
 | 
|---|
| 99 |          $(OBJSDLL)
 | 
|---|
| 100 | 
 | 
|---|
| 101 | pngtest: pngtest.o $(LIBNAME).dylib
 | 
|---|
| 102 |         $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
 | 
|---|
| 103 | 
 | 
|---|
| 104 | test: pngtest
 | 
|---|
| 105 |         ./pngtest
 | 
|---|
| 106 | 
 | 
|---|
| 107 | install-headers: png.h pngconf.h
 | 
|---|
| 108 |         -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
 | 
|---|
| 109 |         -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 | 
|---|
| 110 |         cp png.h pngconf.h $(DI)/$(LIBNAME)
 | 
|---|
| 111 |         chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
 | 
|---|
| 112 |         -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
 | 
|---|
| 113 |         -@/bin/rm -f $(DI)/libpng
 | 
|---|
| 114 |         (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 | 
|---|
| 115 | 
 | 
|---|
| 116 | install-static: install-headers libpng.a
 | 
|---|
| 117 |         -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 | 
|---|
| 118 |         cp libpng.a $(DL)/$(LIBNAME).a
 | 
|---|
| 119 |         chmod 644 $(DL)/$(LIBNAME).a
 | 
|---|
| 120 |         -@/bin/rm -f $(DL)/libpng.a
 | 
|---|
| 121 |         (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 | 
|---|
| 122 | 
 | 
|---|
| 123 | install-shared: install-headers $(LIBNAME).dylib libpng.pc \
 | 
|---|
| 124 |         libpng.3.$(PNGMIN).dylib
 | 
|---|
| 125 |         -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 | 
|---|
| 126 |         -@/bin/rm -f $(DL)/$(LIBNAME).$(PNGVER)*.dylib
 | 
|---|
| 127 |         -@/bin/rm -f $(DL)/$(LIBNAME).dylib
 | 
|---|
| 128 |         -@/bin/rm -f $(DL)/libpng.dylib
 | 
|---|
| 129 |         -@/bin/rm -f $(DL)/libpng.3.dylib
 | 
|---|
| 130 |         -@/bin/rm -f $(DL)/libpng.3.$(PNGMIN)*.dylib
 | 
|---|
| 131 |         cp $(LIBNAME).$(PNGVER).dylib $(DL)
 | 
|---|
| 132 |         cp libpng.3.$(PNGMIN).dylib $(DL)
 | 
|---|
| 133 |         chmod 755 $(DL)/$(LIBNAME).$(PNGVER).dylib
 | 
|---|
| 134 |         chmod 755 $(DL)/libpng.3.$(PNGMIN).dylib
 | 
|---|
| 135 |         (cd $(DL); \
 | 
|---|
| 136 |         ln -sf libpng.3.$(PNGMIN).dylib libpng.3.dylib; \
 | 
|---|
| 137 |         ln -sf libpng.3.dylib libpng.dylib; \
 | 
|---|
| 138 |         ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
 | 
|---|
| 139 |         ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
 | 
|---|
| 140 |         -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
 | 
|---|
| 141 |         -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
 | 
|---|
| 142 |         -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
 | 
|---|
| 143 |         cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 | 
|---|
| 144 |         chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
 | 
|---|
| 145 |         (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
 | 
|---|
| 146 | 
 | 
|---|
| 147 | install-man: libpng.3 libpngpf.3 png.5
 | 
|---|
| 148 |         -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 | 
|---|
| 149 |         -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
 | 
|---|
| 150 |         -@/bin/rm -f $(DM)/man3/libpng.3
 | 
|---|
| 151 |         -@/bin/rm -f $(DM)/man3/libpngpf.3
 | 
|---|
| 152 |         cp libpng.3 $(DM)/man3
 | 
|---|
| 153 |         cp libpngpf.3 $(DM)/man3
 | 
|---|
| 154 |         -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
 | 
|---|
| 155 |         -@/bin/rm -f $(DM)/man5/png.5
 | 
|---|
| 156 |         cp png.5 $(DM)/man5
 | 
|---|
| 157 | 
 | 
|---|
| 158 | install-config: libpng-config
 | 
|---|
| 159 |         -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
 | 
|---|
| 160 |         -@/bin/rm -f $(DB)/libpng-config
 | 
|---|
| 161 |         -@/bin/rm -f $(DB)/$(LIBNAME)-config
 | 
|---|
| 162 |         cp libpng-config $(DB)/$(LIBNAME)-config
 | 
|---|
| 163 |         chmod 755 $(DB)/$(LIBNAME)-config
 | 
|---|
| 164 |         (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
 | 
|---|
| 165 | 
 | 
|---|
| 166 | install: install-static install-shared install-man install-config
 | 
|---|
| 167 | 
 | 
|---|
| 168 | # If you installed in $(DESTDIR), test-installed won't work until you
 | 
|---|
| 169 | # move the library to its final location.
 | 
|---|
| 170 | 
 | 
|---|
| 171 | test-installed:
 | 
|---|
| 172 |         $(CC) $(CFLAGS) \
 | 
|---|
| 173 |            `$(BINPATH)/libpng12-config --cflags` pngtest.c \
 | 
|---|
| 174 |            -L$(ZLIBLIB) \
 | 
|---|
| 175 |            -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
 | 
|---|
| 176 |         ./pngtesti pngtest.png
 | 
|---|
| 177 | 
 | 
|---|
| 178 | clean:
 | 
|---|
| 179 |         rm -f *.o libpng.a pngtest pngout.png libpng-config \
 | 
|---|
| 180 |         libpng.3.$(PNGMIN).dylib \
 | 
|---|
| 181 |         libpng.pc $(LIBNAME).*dylib pngtesti
 | 
|---|
| 182 | 
 | 
|---|
| 183 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 | 
|---|
| 184 | writelock:
 | 
|---|
| 185 |         chmod a-w *.[ch35] $(DOCS) scripts/*
 | 
|---|
| 186 | 
 | 
|---|
| 187 | # DO NOT DELETE THIS LINE -- make depend depends on it.
 | 
|---|
| 188 | 
 | 
|---|
| 189 | png.o png.pic.o: png.h pngconf.h
 | 
|---|
| 190 | pngerror.o pngerror.pic.o: png.h pngconf.h
 | 
|---|
| 191 | pngrio.o pngrio.pic.o: png.h pngconf.h
 | 
|---|
| 192 | pngwio.o pngwio.pic.o: png.h pngconf.h
 | 
|---|
| 193 | pngmem.o pngmem.pic.o: png.h pngconf.h
 | 
|---|
| 194 | pngset.o pngset.pic.o: png.h pngconf.h
 | 
|---|
| 195 | pngget.o pngget.pic.o: png.h pngconf.h
 | 
|---|
| 196 | pngread.o pngread.pic.o: png.h pngconf.h
 | 
|---|
| 197 | pngrtran.o pngrtran.pic.o: png.h pngconf.h
 | 
|---|
| 198 | pngrutil.o pngrutil.pic.o: png.h pngconf.h
 | 
|---|
| 199 | pngtrans.o pngtrans.pic.o: png.h pngconf.h
 | 
|---|
| 200 | pngwrite.o pngwrite.pic.o: png.h pngconf.h
 | 
|---|
| 201 | pngwtran.o pngwtran.pic.o: png.h pngconf.h
 | 
|---|
| 202 | pngwutil.o pngwutil.pic.o: png.h pngconf.h
 | 
|---|
| 203 | pngpread.o pngpread.pic.o: png.h pngconf.h
 | 
|---|
| 204 | 
 | 
|---|
| 205 | pngtest.o: png.h pngconf.h
 | 
|---|