]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.cygwin
Derive wxWebViewEvent from wxNotifyEvent.
[wxWidgets.git] / src / png / scripts / makefile.cygwin
CommitLineData
0272a10d
VZ
1# makefile for cygwin 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 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
0272a10d
VZ
14
15# This makefile intends to support building outside the src directory
16# if desired. When invoking it, specify an argument to SRCDIR on the
17# command line that points to the top of the directory where your source
18# is located.
19
20ifdef SRCDIR
21VPATH = $(SRCDIR)
22else
23SRCDIR = .
24endif
25
26# Override DESTDIR= on the make install command line to easily support
27# installing into a temporary location. Example:
28#
29# make install DESTDIR=/tmp/build/libpng
30#
31# If you're going to install into a temporary location
32# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
33# you execute make install.
34
35DESTDIR=
36
37CC=gcc
38ifdef MINGW
39MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
40MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
41endif
42
43# Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
44ifndef prefix
45prefix=/usr
46$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
47endif
48exec_prefix=$(prefix)
49
50# Where the zlib library and include files are located
51ZLIBLIB= /usr/lib
52ZLIBINC=
53#ZLIBLIB=../zlib
54#ZLIBINC=../zlib
55
56ALIGN=
57# for i386:
58#ALIGN=-malign-loops=2 -malign-functions=2
59
60WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
61 -Wmissing-declarations -Wtraditional -Wcast-align \
62 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
63
0272a10d 64CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
b61cc19c 65 -W -Wall -O3 $(ALIGN) -funroll-loops \
0272a10d
VZ
66 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
67
b61cc19c
PC
68LIBNAME = libpng14
69PNGMAJ = 14
70CYGDLL = 14
0272a10d
VZ
71
72SHAREDLIB=cygpng$(CYGDLL).dll
73STATLIB=libpng.a
74IMPLIB=libpng.dll.a
75SHAREDDEF=libpng.def
76LIBS=$(SHAREDLIB) $(STATLIB)
77EXE=.exe
78
79LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
80LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
81LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
82
83MKDIR_P=/bin/mkdir -pv
84RANLIB=ranlib
85#RANLIB=echo
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)! \
b61cc19c 133 -e s!-lpng14!-lpng14\ -lz! > libpng.pc
0272a10d
VZ
134
135libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
136 @echo -e Making $(LIBNAME) libpng-config file for this libpng \
137 installation..'\n' using PREFIX=\"$(prefix)\"'\n'
138 ( cat $(S)/scripts/libpng-config-head.in; \
139 echo prefix=\"$(prefix)\"; \
140 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
141 echo L_opts=\"-L$(LIBPATH)\"; \
142 echo libs=\"-lpng$(CYGDLL) -lz\"; \
143 cat $(S)/scripts/libpng-config-body.in ) > libpng-config
144 chmod +x libpng-config
145
146static: all-static
147shared: all-shared
148all-static: $(STATLIB) pngtest-stat$(EXE)
149all-shared: $(SHAREDLIB) pngtest$(EXE)
150
151$(STATLIB): $(OBJS)
152 ar rc $@ $(OBJS)
153 $(RANLIB) $@
154
b61cc19c 155$(SHAREDDEF): scripts/pngwin.def
0272a10d
VZ
156 cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
157 sed -e 's/\([^;]*\);/;/' > $@
158
159$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
160 $(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
161
162pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
163 $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
164
165pngtest-stat$(EXE): pngtest.o $(STATLIB)
166 $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
167
168pngtest.pic.o: pngtest.c
169 $(CC) $(CFLAGS) -c $< -o $@
170
b61cc19c 171pngtest.o: pngtest.c png.h pngconf.h
0272a10d
VZ
172 $(CC) $(CFLAGS) -c $< -o $@
173
174test: test-static test-shared
175
176test-static: pngtest-stat$(EXE)
177 ./pngtest-stat $(S)/pngtest.png
178
179test-shared: pngtest$(EXE)
180 ./pngtest $(S)/pngtest.png
181
182install-static: $(STATLIB) install-headers install-man
183 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
184 install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
185 -@rm -f $(DL)/$(STATLIB)
186 (cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
187
188install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
189 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
190 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
191 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
192 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
193 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
194 install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
195 -@rm -f $(DL)/$(IMPLIB)
196 (cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
197 install -s -m 755 $(SHAREDLIB) $(DB)
198 install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
199 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
200
201install-headers:
202 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
203 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
204 -@rm -f $(DI)/png.h
205 -@rm -f $(DI)/pngconf.h
206 install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
207 -@rm -f $(DI)/libpng
208 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
209
210install-man:
211 -@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR_P) $(D)$(MAN3PATH); fi
212 -@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR_P) $(D)$(MAN5PATH); fi
213 install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
214 install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
215
216install-config: libpng-config
217 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
218 -@/bin/rm -f $(DB)/libpng-config
219 -@/bin/rm -f $(DB)/$(LIBNAME)-config
220 cp libpng-config $(DB)/$(LIBNAME)-config
221 chmod 755 $(DB)/$(LIBNAME)-config
222 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
223
224# Run this to verify that a future `configure' run will pick up the settings
225# you want.
226test-config-install: SHELL=/bin/bash
227test-config-install: $(DB)/libpng-config
228 @echo -e Testing libpng-config functions...'\n'
229 @ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
230 do \
231 printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
232 "$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
233 gytiu=$$(( $$gytiu + 1 )); \
234 done
235
236install: install-static install-shared install-man install-config
237
238# If you installed in $(DESTDIR), test-installed won't work until you
239# move the library to its final location. Use test-dd to test it
240# before then.
241
242test-dd:
243 echo
244 echo Testing installed dynamic shared library in $(DL).
245 $(CC) -I$(DI) $(CFLAGS) \
b61cc19c 246 `$(BINPATH)/libpng14-config --cflags` pngtest.c \
0272a10d 247 -L$(DL) -L$(ZLIBLIB) \
b61cc19c 248 -o pngtestd `$(BINPATH)/libpng14-config --ldflags`
0272a10d
VZ
249 ./pngtestd pngtest.png
250
251test-installed:
252 $(CC) $(CFLAGS) \
b61cc19c 253 `$(BINPATH)/libpng14-config --cflags` pngtest.c \
0272a10d 254 -L$(ZLIBLIB) \
b61cc19c 255 -o pngtesti$(EXE) `$(BINPATH)/libpng14-config --ldflags`
0272a10d
VZ
256 ./pngtesti$(EXE) pngtest.png
257
258clean:
259 /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
260 pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
261 libpng-config libpng.pc pngtesti$(EXE)
262
263DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
264writelock:
265 chmod a-w *.[ch35] $(DOCS) scripts/*
266
267.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
268
269# DO NOT DELETE THIS LINE -- make depend depends on it.
270
b61cc19c
PC
271png.o png.pic.o: png.h pngconf.h pngpriv.h png.c
272pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngerror.c
273pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngrio.c
274pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngwio.c
275pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngmem.c
276pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngset.c
277pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngget.c
278pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngread.c
279pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngrtran.c
280pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngrutil.c
281pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngtrans.c
282pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngwrite.c
283pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngwtran.c
284pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngwutil.c
285pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngpread.c
0272a10d
VZ
286
287pngtest.o: png.h pngconf.h pngtest.c
288pngtest-stat.o: png.h pngconf.h pngtest.c
289
290
291