]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.darwin
better variant support, fixes #11114
[wxWidgets.git] / src / png / scripts / makefile.darwin
CommitLineData
0272a10d 1# makefile for libpng on Darwin / Mac OS X
970f6abe 2# Copyright (C) 2002, 2004, 2006, 2008 Glenn Randers-Pehrson
0272a10d
VZ
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
10prefix=/usr/local
11exec_prefix=$(prefix)
12
13# Where the zlib library and include files are located
14#ZLIBLIB=/usr/local/lib
15#ZLIBINC=/usr/local/include
16ZLIBLIB=../zlib
17ZLIBINC=../zlib
18
19# Library name:
20LIBNAME = libpng12
970f6abe
VZ
21PNGMAJ = 12
22PNGMIN = 1.2.34
0272a10d
VZ
23PNGVER = $(PNGMAJ).$(PNGMIN)
24
25# Shared library names:
26LIBSO=$(LIBNAME).dylib
27LIBSOMAJ=$(LIBNAME).$(PNGMAJ).dylib
28LIBSOVER=$(LIBNAME).$(PNGVER).dylib
29OLDSO=libpng.dylib
30OLDSOMAJ=libpng.3.dylib
31OLDSOVER=libpng.3.$(PNGMIN).dylib
32
33# Utilities:
34CC=cc
35AR_RC=ar rc
36MKDIR_P=mkdir -p
37LN_SF=ln -sf
38RANLIB=ranlib
39RM_F=/bin/rm -f
40
970f6abe
VZ
41# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE
42CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops
0272a10d
VZ
43LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
44
45INCPATH=$(prefix)/include
46LIBPATH=$(exec_prefix)/lib
47MANPATH=$(prefix)/man
48BINPATH=$(exec_prefix)/bin
49
50# override DESTDIR= on the make install command line to easily support
51# installing into a temporary location. Example:
52#
53# make install DESTDIR=/tmp/build/libpng
54#
55# If you're going to install into a temporary location
56# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
57# you execute make install.
58DESTDIR=
59
60DB=$(DESTDIR)$(BINPATH)
61DI=$(DESTDIR)$(INCPATH)
62DL=$(DESTDIR)$(LIBPATH)
63DM=$(DESTDIR)$(MANPATH)
64
65OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
66 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
67 pngwtran.o pngmem.o pngerror.o pngpread.o
68
69OBJSDLL = $(OBJS:.o=.pic.o)
70
71.SUFFIXES: .c .o .pic.o
72
73.c.pic.o:
74 $(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
75
76all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
77
78libpng.a: $(OBJS)
79 $(AR_RC) $@ $(OBJS)
80 $(RANLIB) $@
81
82libpng.pc:
970f6abe
VZ
83 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
84 -e s!@exec_prefix@!$(exec_prefix)! \
85 -e s!@libdir@!$(LIBPATH)! \
86 -e s!@includedir@!$(INCPATH)! \
87 -e s!-lpng12!-lpng12\ -lz! > libpng.pc
0272a10d
VZ
88
89libpng-config:
90 ( cat scripts/libpng-config-head.in; \
91 echo prefix=\"$(prefix)\"; \
92 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
93 echo L_opts=\"-L$(LIBPATH)\"; \
94 echo libs=\"-lpng12 -lz\"; \
95 cat scripts/libpng-config-body.in ) > libpng-config
96 chmod +x libpng-config
97
98$(LIBSO): $(LIBSOMAJ)
99 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
100
101$(LIBSOMAJ): $(LIBSOVER)
102 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
103
104$(LIBSOVER): $(OBJSDLL)
105 $(CC) -dynamiclib \
106 -install_name $(LIBPATH)/$(LIBSOMAJ) \
970f6abe 107 -current_version 0 -compatibility_version 0 \
0272a10d
VZ
108 -o $(LIBSOVER) \
109 $(OBJSDLL) -L$(ZLIBLIB) -lz
110
111$(OLDSOVER): $(OBJSDLL)
112 $(CC) -dynamiclib \
113 -install_name $(LIBPATH)/$(OLDSOMAJ) \
114 -current_version 3 -compatibility_version 3 \
115 -o $(OLDSOVER) \
116 $(OBJSDLL) -L$(ZLIBLIB) -lz
117
118pngtest: pngtest.o $(LIBSO)
119 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
120
121test: pngtest
122 ./pngtest
123
124install-headers: png.h pngconf.h
125 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
126 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
127 cp png.h pngconf.h $(DI)/$(LIBNAME)
128 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
129 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
130 -@$(RM_F) $(DI)/libpng
131 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
132
133install-static: install-headers libpng.a
134 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
135 cp libpng.a $(DL)/$(LIBNAME).a
136 chmod 644 $(DL)/$(LIBNAME).a
137 $(RANLIB) $(DL)/$(LIBNAME).a
138 -@$(RM_F) $(DL)/libpng.a
139 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
140
141install-shared: install-headers $(LIBSO) libpng.pc \
142 $(OLDSOVER)
143 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
144 -@$(RM_F) $(DL)/$(LIBNAME).$(PNGVER)*.dylib
145 -@$(RM_F) $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
146 -@$(RM_F) $(DL)/$(LIBSO)
147 -@$(RM_F) $(DL)/$(OLDSO)
148 -@$(RM_F) $(DL)/$(OLDSOMAJ)
149 -@$(RM_F) $(DL)/libpng.3.$(PNGMIN)*.dylib
150 cp $(LIBSOVER) $(DL)
151 cp $(OLDSOVER) $(DL)
152 chmod 755 $(DL)/$(LIBSOVER)
153 chmod 755 $(DL)/$(OLDSOVER)
154 (cd $(DL); \
155 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
156 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
157 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
158 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
159 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
160 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
161 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
162 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
163 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
164 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
165
166install-man: libpng.3 libpngpf.3 png.5
167 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
168 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
169 -@$(RM_F) $(DM)/man3/libpng.3
170 -@$(RM_F) $(DM)/man3/libpngpf.3
171 cp libpng.3 $(DM)/man3
172 cp libpngpf.3 $(DM)/man3
173 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
174 -@$(RM_F) $(DM)/man5/png.5
175 cp png.5 $(DM)/man5
176
177install-config: libpng-config
178 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
179 -@$(RM_F) $(DB)/libpng-config
180 -@$(RM_F) $(DB)/$(LIBNAME)-config
181 cp libpng-config $(DB)/$(LIBNAME)-config
182 chmod 755 $(DB)/$(LIBNAME)-config
183 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
184
185install: install-static install-shared install-man install-config
186
187# If you installed in $(DESTDIR), test-installed won't work until you
188# move the library to its final location. Use test-dd to test it
189# before then.
190
191test-dd:
192 echo
193 echo Testing installed dynamic shared library in $(DL).
194 $(CC) -I$(DI) -I$(ZLIBINC) \
195 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
196 -L$(DL) -L$(ZLIBLIB) \
197 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
198 ./pngtestd pngtest.png
199
200test-installed:
201 $(CC) $(CFLAGS) \
202 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
203 -L$(ZLIBLIB) \
204 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
205 ./pngtesti pngtest.png
206
207clean:
208 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
209 $(OLDSOVER) \
210 libpng.pc $(LIBNAME).*dylib pngtesti
211
212DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
213writelock:
214 chmod a-w *.[ch35] $(DOCS) scripts/*
215
216# DO NOT DELETE THIS LINE -- make depend depends on it.
217
218png.o png.pic.o: png.h pngconf.h
219pngerror.o pngerror.pic.o: png.h pngconf.h
220pngrio.o pngrio.pic.o: png.h pngconf.h
221pngwio.o pngwio.pic.o: png.h pngconf.h
222pngmem.o pngmem.pic.o: png.h pngconf.h
223pngset.o pngset.pic.o: png.h pngconf.h
224pngget.o pngget.pic.o: png.h pngconf.h
225pngread.o pngread.pic.o: png.h pngconf.h
226pngrtran.o pngrtran.pic.o: png.h pngconf.h
227pngrutil.o pngrutil.pic.o: png.h pngconf.h
228pngtrans.o pngtrans.pic.o: png.h pngconf.h
229pngwrite.o pngwrite.pic.o: png.h pngconf.h
230pngwtran.o pngwtran.pic.o: png.h pngconf.h
231pngwutil.o pngwutil.pic.o: png.h pngconf.h
232pngpread.o pngpread.pic.o: png.h pngconf.h
233
234pngtest.o: png.h pngconf.h