]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.macosx
Applied patch [ 774886 ] wxnotebook bug
[wxWidgets.git] / src / png / scripts / makefile.macosx
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
7
8 # where make install puts libpng.a and png.h
9 prefix=/usr/local
10
11 # Where the zlib library and include files are located
12 #ZLIBLIB=/usr/local/lib
13 #ZLIBINC=/usr/local/include
14 ZLIBLIB=../zlib
15 ZLIBINC=../zlib
16
17 CC=cc
18
19 PNGMAJ = 0
20 PNGMIN = 1.2.4
21 PNGVER = $(PNGMAJ).$(PNGMIN)
22
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)
27
28 LIBNAME=libpng12
29 SHAREDLIB_POSTFIX=dylib
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 #RANLIB=echo
51 RANLIB=ranlib
52
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
56
57 all: libpng.a pngtest shared libpng.pc libpng-config
58
59 shared: $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
60
61 libpng.pc:
62 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
63 sed -e s/-lm// > libpng.pc
64
65 libpng-config:
66 ( cat scripts/libpng-config-head.in; \
67 echo prefix=\"$(prefix)\"; \
68 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
69 echo cflags=\"\"; \
70 echo ldflags=\"-L$(LIBPATH)\"; \
71 echo libs=\"-lpng12 -lz\"; \
72 cat scripts/libpng-config-body.in ) > libpng-config
73 chmod +x libpng-config
74
75 libpng.a: $(OBJS)
76 ar rc $@ $(OBJS)
77 $(RANLIB) $@
78
79 $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX): $(OBJS)
80 $(LDSHARED) -o $@ $(OBJS)
81
82 pngtest: pngtest.o libpng.a
83 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
84
85 test: pngtest
86 ./pngtest
87
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)/* .)
96
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)
103
104 install-shared: install-headers $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) libpng.pc
105 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
106 -@/bin/rm -f \
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)
114 (cd $(DL); \
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)
131
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
141 cp png.5 $(DM)/man5
142
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)
150
151 install: install-static install-shared install-man install-config
152
153 # If you installed in $(DESTDIR), test-installed won't work until you
154 # move the library to its final location.
155
156 test-installed:
157 $(CC) $(CFLAGS) \
158 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
159 -L$(ZLIBLIB) \
160 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
161 ./pngtesti pngtest.png
162
163 clean:
164 rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
165 $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
166 $(LIBNAME).$(SHAREDLIB_POSTFIX)
167
168 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
169 writelock:
170 chmod a-w *.[ch35] $(DOCS) scripts/*
171
172 # DO NOT DELETE THIS LINE -- make depend depends on it.
173
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
190