]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.mingw
Fix recursion problems when loading pages from a virtual file system using the WebKit...
[wxWidgets.git] / src / png / scripts / makefile.mingw
CommitLineData
0272a10d
VZ
1# makefile for mingw on x86
2# Builds both dll (with import lib) and static lib versions
3# of the library, and builds two copies of pngtest: one
4# statically linked and one dynamically linked.
5#
970f6abe 6# Copyright (C) 2002, 2006, 2008 Soren Anderson, Charles Wilson,
0272a10d
VZ
7# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
8# Copyright (C) 1998-2000, 2007 Greg Roelofs
9# Copyright (C) 1996, 1997 Andreas Dilger
b61cc19c
PC
10#
11# This code is released under the libpng license.
12# For conditions of distribution and use, see the disclaimer
13# and license in png.h
14
15# Built from makefile.cygwin
0272a10d 16
b61cc19c
PC
17# This makefile expects to be run under the MSYS shell (part of
18# the MINGW project) and not under CMD.EXE which does not provide
19# "cat" or "sed".
0272a10d
VZ
20
21# This makefile intends to support building outside the src directory
22# if desired. When invoking it, specify an argument to SRCDIR on the
23# command line that points to the top of the directory where your source
24# is located.
25ifdef SRCDIR
26VPATH = $(SRCDIR)
27else
28SRCDIR = .
29endif
30
31# Override DESTDIR= on the make install command line to easily support
32# installing into a temporary location. Example:
33#
34# make install DESTDIR=/tmp/build/libpng
35#
36# If you're going to install into a temporary location
37# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
38# you execute make install.
39DESTDIR=
40
41# If you're using a cross-compiler, add the appropriate prefix (e.g.,
42# "i386-mingw32msvc-") to the following three commands:
43CC=gcc
44AR=ar
45RANLIB=ranlib
46
47MKDIR_P=/bin/mkdir -pv
48
49# Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
50ifndef prefix
51prefix=/usr
52$(warning "You haven't specified a 'prefix=' location. Defaulting to '/usr'")
53endif
54exec_prefix=$(prefix)
55
56# Where the zlib library and include files are located
57ZLIBLIB= /usr/lib
58ZLIBINC=
59
60ALIGN=
61# for i386:
62#ALIGN=-malign-loops=2 -malign-functions=2
63
64WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
65 -Wmissing-declarations -Wtraditional -Wcast-align \
66 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
67
0272a10d 68CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
b61cc19c 69 -W -Wall -O3 $(ALIGN) -funroll-loops \
0272a10d
VZ
70 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
71
b61cc19c
PC
72LIBNAME = libpng14
73PNGMAJ = 14
74MINGDLL = 14
0272a10d
VZ
75
76SHAREDLIB=libpng$(MINGDLL).dll
77STATLIB=libpng.a
78IMPLIB=libpng.dll.a
79SHAREDDEF=libpng.def
80LIBS=$(SHAREDLIB) $(STATLIB)
81EXE=.exe
82
83LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
84LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS))
85LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
86
87INCPATH=$(prefix)/include
88LIBPATH=$(exec_prefix)/lib
89
90BINPATH=$(exec_prefix)/bin
91MANPATH=$(prefix)/man
92MAN3PATH=$(MANPATH)/man3
93MAN5PATH=$(MANPATH)/man5
94
95# cosmetic: shortened strings:
96S =$(SRCDIR)
97D =$(DESTDIR)
98DB =$(D)$(BINPATH)
99DI =$(D)$(INCPATH)
100DL =$(D)$(LIBPATH)
101
102OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
103 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
104 pngwtran.o pngmem.o pngerror.o pngpread.o
105
106OBJSDLL = $(OBJS:.o=.pic.o)
107
108.SUFFIXES: .c .o .pic.o
109
110%.o : %.c
111 $(CC) -c $(CFLAGS) -o $@ $<
112%.pic.o : CFLAGS += -DPNG_BUILD_DLL
113%.pic.o : %.c
114 $(CC) -c $(CFLAGS) -o $@ $<
115
116all: all-static all-shared libpng.pc libpng-config libpng.pc libpng-config
117
118# Make this to verify that "make [...] install" will do what you want.
119buildsetup-tell:
120 @echo VPATH is set to: \"$(VPATH)\"
121 @echo prefix is set to: \"$(prefix)\"
122 @echo -e INCPATH,LIBPATH, etc. are set to:'\n' \
123 $(addprefix $(D),$(INCPATH)'\n' $(LIBPATH)'\n' $(BINPATH)'\n' \
124 $(MANPATH)'\n' $(MAN3PATH)'\n' $(MAN5PATH)'\n')'\n'
125
126libpng.pc: scripts/libpng.pc.in
127 @echo -e Making pkg-config file for this libpng installation..'\n' \
128 using PREFIX=\"$(prefix)\"'\n'
970f6abe
VZ
129 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
130 -e s!@exec_prefix@!$(exec_prefix)! \
131 -e s!@libdir@!$(LIBPATH)! \
132 -e s!@includedir@!$(INCPATH)! \
133 -e s!@includedir@!$(INCPATH)! \
b61cc19c 134 -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
0272a10d
VZ
135
136libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
137 @echo -e Making $(LIBNAME) libpng-config file for this libpng \
138 installation..'\n' using PREFIX=\"$(prefix)\"'\n'
139 ( cat $(S)/scripts/libpng-config-head.in; \
140 echo prefix=\"$(prefix)\"; \
141 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
142 echo L_opts=\"-L$(LIBPATH)\"; \
143 echo libs=\"-lpng$(MINGDLL) -lz\"; \
144 cat $(S)/scripts/libpng-config-body.in ) > libpng-config
145 chmod +x libpng-config
146
147static: all-static
148shared: all-shared
149all-static: $(STATLIB) pngtest-stat$(EXE)
150all-shared: $(SHAREDLIB) pngtest$(EXE)
151
152$(STATLIB): $(OBJS)
153 $(AR) rc $@ $(OBJS)
154 $(RANLIB) $@
155
b61cc19c 156$(SHAREDDEF): scripts/pngwin.def
0272a10d
VZ
157 cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
158 sed -e 's/\([^;]*\);/;/' > $@
159
160$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
161 $(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
162
163pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
164 $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
165
166pngtest-stat$(EXE): pngtest.o $(STATLIB)
167 $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
168
169test: test-static test-shared
170
171test-static: pngtest-stat$(EXE)
172 ./pngtest-stat $(S)/pngtest.png
173
174test-shared: pngtest$(EXE)
175 ./pngtest $(S)/pngtest.png
176
177install-static: $(STATLIB) install-headers install-man
178 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
179 install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
180 -@rm -f $(DL)/$(STATLIB)
181 (cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
182
183install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
184 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
185 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
186 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
187 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
188 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
189 install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
190 -@rm -f $(DL)/$(IMPLIB)
191 (cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
192 install -s -m 755 $(SHAREDLIB) $(DB)
193 install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
194 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
195
196install-headers:
197 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
198 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
199 -@rm -f $(DI)/png.h
200 -@rm -f $(DI)/pngconf.h
201 install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
202 -@rm -f $(DI)/libpng
203 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
204
205install-man:
206 -@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR_P) $(D)$(MAN3PATH); fi
207 -@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR_P) $(D)$(MAN5PATH); fi
208 install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
209 install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
210
211install-config: libpng-config
212 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
213 -@/bin/rm -f $(DB)/libpng-config
214 -@/bin/rm -f $(DB)/$(LIBNAME)-config
215 cp libpng-config $(DB)/$(LIBNAME)-config
216 chmod 755 $(DB)/$(LIBNAME)-config
217 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
218
219# Run this to verify that a future `configure' run will pick up the settings
220# you want.
221test-config-install: SHELL=/bin/bash
222test-config-install: $(DB)/libpng-config
223 @echo -e Testing libpng-config functions...'\n'
224 @ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
225 do \
226 printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
227 "$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
228 gytiu=$$(( $$gytiu + 1 )); \
229 done
230
231install: install-static install-shared install-man install-config
232
233# If you installed in $(DESTDIR), test-installed won't work until you
234# move the library to its final location. Use test-dd to test it
235# before then.
236
237test-dd:
238 echo
239 echo Testing installed dynamic shared library in $(DL).
240 $(CC) -I$(DI) $(CFLAGS) \
b61cc19c 241 `$(BINPATH)/libpng14-config --cflags` pngtest.c \
0272a10d 242 -L$(DL) -L$(ZLIBLIB) \
b61cc19c 243 -o pngtestd `$(BINPATH)/libpng14-config --ldflags`
0272a10d
VZ
244 ./pngtestd pngtest.png
245
246test-installed:
247 $(CC) $(CFLAGS) \
b61cc19c 248 `$(BINPATH)/libpng14-config --cflags` pngtest.c \
0272a10d 249 -L$(ZLIBLIB) \
b61cc19c 250 -o pngtesti$(EXE) `$(BINPATH)/libpng14-config --ldflags`
0272a10d
VZ
251 ./pngtesti$(EXE) pngtest.png
252
253clean:
254 /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
255 pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
256 libpng-config libpng.pc pngtesti$(EXE)
257
258DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
259writelock:
260 chmod a-w *.[ch35] $(DOCS) scripts/*
261
262.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
263
264# DO NOT DELETE THIS LINE -- make depend depends on it.
265
b61cc19c
PC
266png.o png.pic.o: png.h pngconf.h pngpriv.h png.c
267pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngerror.c
268pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngrio.c
269pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngwio.c
270pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngmem.c
271pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngset.c
272pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngget.c
273pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngread.c
274pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngrtran.c
275pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngrutil.c
276pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngtrans.c
277pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngwrite.c
278pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngwtran.c
279pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngwutil.c
280pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngpread.c
0272a10d
VZ
281
282pngtest.o pngtest.pic.o: png.h pngconf.h pngtest.c