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