]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.darwin
fix for link errors in DLL build
[wxWidgets.git] / src / png / scripts / makefile.darwin
CommitLineData
0272a10d
VZ
1# makefile for libpng on Darwin / Mac OS X
2# Copyright (C) 2002, 2004, 2006 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
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
21PNGMAJ = 0
22PNGMIN = 1.2.20
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
41# CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE
42CFLAGS=-I$(ZLIBINC) -Wall -O -funroll-loops
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:
83 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
84 sed -e s/-lm// > libpng.pc
85
86libpng-config:
87 ( cat scripts/libpng-config-head.in; \
88 echo prefix=\"$(prefix)\"; \
89 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
90 echo L_opts=\"-L$(LIBPATH)\"; \
91 echo libs=\"-lpng12 -lz\"; \
92 cat scripts/libpng-config-body.in ) > libpng-config
93 chmod +x libpng-config
94
95$(LIBSO): $(LIBSOMAJ)
96 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
97
98$(LIBSOMAJ): $(LIBSOVER)
99 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
100
101$(LIBSOVER): $(OBJSDLL)
102 $(CC) -dynamiclib \
103 -install_name $(LIBPATH)/$(LIBSOMAJ) \
104 -current_version $(PNGVER) -compatibility_version $(PNGVER) \
105 -o $(LIBSOVER) \
106 $(OBJSDLL) -L$(ZLIBLIB) -lz
107
108$(OLDSOVER): $(OBJSDLL)
109 $(CC) -dynamiclib \
110 -install_name $(LIBPATH)/$(OLDSOMAJ) \
111 -current_version 3 -compatibility_version 3 \
112 -o $(OLDSOVER) \
113 $(OBJSDLL) -L$(ZLIBLIB) -lz
114
115pngtest: pngtest.o $(LIBSO)
116 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
117
118test: pngtest
119 ./pngtest
120
121install-headers: png.h pngconf.h
122 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
123 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
124 cp png.h pngconf.h $(DI)/$(LIBNAME)
125 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
126 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
127 -@$(RM_F) $(DI)/libpng
128 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
129
130install-static: install-headers libpng.a
131 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
132 cp libpng.a $(DL)/$(LIBNAME).a
133 chmod 644 $(DL)/$(LIBNAME).a
134 $(RANLIB) $(DL)/$(LIBNAME).a
135 -@$(RM_F) $(DL)/libpng.a
136 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
137
138install-shared: install-headers $(LIBSO) libpng.pc \
139 $(OLDSOVER)
140 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
141 -@$(RM_F) $(DL)/$(LIBNAME).$(PNGVER)*.dylib
142 -@$(RM_F) $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
143 -@$(RM_F) $(DL)/$(LIBSO)
144 -@$(RM_F) $(DL)/$(OLDSO)
145 -@$(RM_F) $(DL)/$(OLDSOMAJ)
146 -@$(RM_F) $(DL)/libpng.3.$(PNGMIN)*.dylib
147 cp $(LIBSOVER) $(DL)
148 cp $(OLDSOVER) $(DL)
149 chmod 755 $(DL)/$(LIBSOVER)
150 chmod 755 $(DL)/$(OLDSOVER)
151 (cd $(DL); \
152 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
153 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
154 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
155 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
156 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
157 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
158 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
159 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
160 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
161 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
162
163install-man: libpng.3 libpngpf.3 png.5
164 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
165 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
166 -@$(RM_F) $(DM)/man3/libpng.3
167 -@$(RM_F) $(DM)/man3/libpngpf.3
168 cp libpng.3 $(DM)/man3
169 cp libpngpf.3 $(DM)/man3
170 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
171 -@$(RM_F) $(DM)/man5/png.5
172 cp png.5 $(DM)/man5
173
174install-config: libpng-config
175 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
176 -@$(RM_F) $(DB)/libpng-config
177 -@$(RM_F) $(DB)/$(LIBNAME)-config
178 cp libpng-config $(DB)/$(LIBNAME)-config
179 chmod 755 $(DB)/$(LIBNAME)-config
180 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
181
182install: install-static install-shared install-man install-config
183
184# If you installed in $(DESTDIR), test-installed won't work until you
185# move the library to its final location. Use test-dd to test it
186# before then.
187
188test-dd:
189 echo
190 echo Testing installed dynamic shared library in $(DL).
191 $(CC) -I$(DI) -I$(ZLIBINC) \
192 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
193 -L$(DL) -L$(ZLIBLIB) \
194 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
195 ./pngtestd pngtest.png
196
197test-installed:
198 $(CC) $(CFLAGS) \
199 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
200 -L$(ZLIBLIB) \
201 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
202 ./pngtesti pngtest.png
203
204clean:
205 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
206 $(OLDSOVER) \
207 libpng.pc $(LIBNAME).*dylib pngtesti
208
209DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
210writelock:
211 chmod a-w *.[ch35] $(DOCS) scripts/*
212
213# DO NOT DELETE THIS LINE -- make depend depends on it.
214
215png.o png.pic.o: png.h pngconf.h
216pngerror.o pngerror.pic.o: png.h pngconf.h
217pngrio.o pngrio.pic.o: png.h pngconf.h
218pngwio.o pngwio.pic.o: png.h pngconf.h
219pngmem.o pngmem.pic.o: png.h pngconf.h
220pngset.o pngset.pic.o: png.h pngconf.h
221pngget.o pngget.pic.o: png.h pngconf.h
222pngread.o pngread.pic.o: png.h pngconf.h
223pngrtran.o pngrtran.pic.o: png.h pngconf.h
224pngrutil.o pngrutil.pic.o: png.h pngconf.h
225pngtrans.o pngtrans.pic.o: png.h pngconf.h
226pngwrite.o pngwrite.pic.o: png.h pngconf.h
227pngwtran.o pngwtran.pic.o: png.h pngconf.h
228pngwutil.o pngwutil.pic.o: png.h pngconf.h
229pngpread.o pngpread.pic.o: png.h pngconf.h
230
231pngtest.o: png.h pngconf.h