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