1 # makefile for libpng, MACOS X
2 # Copyright (C) 2002 Glenn Randers-Pehrson
3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4 # Modified by Karin Kosina <kyrah@sim.no> 20011010:
5 # build shared library (*.dylib)
6 # For conditions of distribution and use, see copyright notice in png.h
8 # where make install puts libpng.a and png.h
11 # Where the zlib library and include files are located
12 #ZLIBLIB=/usr/local/lib
13 #ZLIBINC=/usr/local/include
21 PNGVER = $(PNGMAJ).$(PNGMIN)
23 CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
24 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
25 LDSHARED=cc -lz -dynamiclib -compatibility_version $(PNGVER) \
26 -current_version $(PNGVER)
29 SHAREDLIB_POSTFIX=dylib
30 INCPATH=$(prefix)/include
35 # override DESTDIR= on the make install command line to easily support
36 # installing into a temporary location. Example:
38 # make install DESTDIR=/tmp/build/libpng
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.
45 DB=$(DESTDIR)$(BINPATH)
46 DI=$(DESTDIR)$(INCPATH)
47 DL=$(DESTDIR)$(LIBPATH)
48 DM=$(DESTDIR)$(MANPATH)
53 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
54 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
55 pngwtran.o pngmem.o pngerror.o pngpread.o
57 all: libpng.a pngtest shared libpng.pc libpng-config
59 shared: $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
62 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
63 sed -e s/-lm// > libpng.pc
66 ( cat scripts/libpng-config-head.in; \
67 echo prefix=\"$(prefix)\"; \
68 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
70 echo ldflags=\"-L$(LIBPATH)\"; \
71 echo libs=\"-lpng12 -lz\"; \
72 cat scripts/libpng-config-body.in ) > libpng-config
73 chmod +x libpng-config
79 $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX): $(OBJS)
80 $(LDSHARED) -o $@ $(OBJS)
82 pngtest: pngtest.o libpng.a
83 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
88 install-headers: png.h pngconf.h
89 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
90 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
91 cp png.h pngconf.h $(DI)/$(LIBNAME)
92 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
93 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
94 -@/bin/rm -f $(DI)/libpng
95 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
97 install-static: install-headers libpng.a
98 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
99 cp libpng.a $(DL)/$(LIBNAME).a
100 chmod 644 $(DL)/$(LIBNAME).a
101 -@/bin/rm -f $(DL)/libpng.a
102 (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
104 install-shared: install-headers $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) libpng.pc
105 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
107 $(DL)/$(LIBNAME).$(PNGMAJ)*.$(SHAREDLIB_POSTFIX)
108 -@/bin/rm -f $(DL)/$(LIBNAME).$(SHAREDLIB_POSTFIX)
109 -@/bin/rm -f libpng.$(SHARED_POSTFIX)
110 -@/bin/rm -f libpng.3.$(SHARED_POSTFIX)
111 -@/bin/rm -f libpng.3.*.$(SHARED_POSTFIX)
112 cp $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) $(DL)
113 chmod 755 $(DL)/$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
115 ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
116 libpng.$(SHARED_POSTFIX); \
117 ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
118 libpng.3.$(SHARED_POSTFIX); \
119 ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
120 libpng.3.$(PNGMIN).$(SHARED_POSTFIX); \
121 ln -f -s $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
122 $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX); \
123 ln -f -s $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX) \
124 $(LIBNAME).$(SHAREDLIB_POSTFIX))
125 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
126 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
127 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
128 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
129 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
130 (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
132 install-man: libpng.3 libpngpf.3 png.5
133 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
134 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
135 -@/bin/rm -f $(DM)/man3/libpng.3
136 -@/bin/rm -f $(DM)/man3/libpngpf.3
137 cp libpng.3 $(DM)/man3
138 cp libpngpf.3 $(DM)/man3
139 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
140 -@/bin/rm -f $(DM)/man5/png.5
143 install-config: libpng-config
144 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
145 -@/bin/rm -f $(DB)/libpng-config
146 -@/bin/rm -f $(DB)/$(LIBNAME)-config
147 cp libpng-config $(DB)/$(LIBNAME)-config
148 chmod 755 $(DB)/$(LIBNAME)-config
149 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
151 install: install-static install-shared install-man install-config
153 # If you installed in $(DESTDIR), test-installed won't work until you
154 # move the library to its final location.
158 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
160 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
161 ./pngtesti pngtest.png
164 rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
165 $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
166 $(LIBNAME).$(SHAREDLIB_POSTFIX)
168 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
170 chmod a-w *.[ch35] $(DOCS) scripts/*
172 # DO NOT DELETE THIS LINE -- make depend depends on it.
174 png.o: png.h pngconf.h
175 pngerror.o: png.h pngconf.h
176 pngrio.o: png.h pngconf.h
177 pngwio.o: png.h pngconf.h
178 pngmem.o: png.h pngconf.h
179 pngset.o: png.h pngconf.h
180 pngget.o: png.h pngconf.h
181 pngread.o: png.h pngconf.h
182 pngrtran.o: png.h pngconf.h
183 pngrutil.o: png.h pngconf.h
184 pngtest.o: png.h pngconf.h
185 pngtrans.o: png.h pngconf.h
186 pngwrite.o: png.h pngconf.h
187 pngwtran.o: png.h pngconf.h
188 pngwutil.o: png.h pngconf.h
189 pngpread.o: png.h pngconf.h