]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.cygwin
colors are only set if non-black, otherwise Enable(false) does not gray them out
[wxWidgets.git] / src / png / scripts / makefile.cygwin
CommitLineData
c6b71bff
GD
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#
6# Copyright (C) 2002 Soren Anderson, Charles Wilson, and Glenn Randers-Pehrson
7# 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
34# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to
35# $CFLAGS, and include pnggccrd.o in $OBJS, below, and in the dependency
36# list at the bottom of this makefile.
37
38CC=gcc
39ifdef MINGW
40MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
41MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
42endif
43
44# Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
45ifndef prefix
46prefix=/usr
47$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
48endif
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
64### if you use the asm, add pnggccrd.o to the OBJS list
65###
66### if you don't need thread safety, but want the asm accel
67#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD \
68# $(addprefix -I,$(ZLIBINC)) -Wall -O3 $(ALIGN) -funroll-loops \
69# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
70### if you need thread safety and want (minimal) asm accel
71#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_USE_PNGGCCRD $(addprefix -I,$(ZLIBINC)) \
72# -Wall -O3 $(ALIGN) -funroll-loops \
73# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
74### Normal (non-asm) compilation
75CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
76 -Wall -O3 $(ALIGN) -funroll-loops \
77 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
78
79LIBNAME = libpng12
80PNGMAJ = 0
81PNGDLL = 13
82PNGMIN = 1.2.4
83PNGVER = $(PNGMAJ).$(PNGMIN)
84
85SHAREDLIB=cygpng$(PNGDLL).dll
86STATLIB=libpng.a
87IMPLIB=libpng.dll.a
88SHAREDDEF=libpng.def
89LIBS=$(SHAREDLIB) $(STATLIB)
90EXE=.exe
91
92LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
93LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
94LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
95
96MKDIR=/bin/mkdir -pv
97RANLIB=ranlib
98#RANLIB=echo
99
100INCPATH=$(prefix)/include
101LIBPATH=$(prefix)/lib
102
103BINPATH=$(prefix)/bin
104MANPATH=$(prefix)/man
105MAN3PATH=$(MANPATH)/man3
106MAN5PATH=$(MANPATH)/man5
107
108# cosmetic: shortened strings:
109S =$(SRCDIR)
110D =$(DESTDIR)
111DB =$(D)$(BINPATH)
112DI =$(D)$(INCPATH)
113DL =$(D)$(LIBPATH)
114
115OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
116 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
117 pngwtran.o pngmem.o pngerror.o pngpread.o # pnggccrd.o
118
119OBJSDLL = $(OBJS:.o=.pic.o)
120
121.SUFFIXES: .c .o .pic.o
122
123%.o : %.c
124 $(CC) -c $(CFLAGS) -o $@ $<
125%.pic.o : CFLAGS += -DPNG_BUILD_DLL
126%.pic.o : %.c
127 $(CC) -c $(CFLAGS) -o $@ $<
128
129all: all-static all-shared libpng.pc libpng-config libpng.pc libpng-config
130
131# Make this to verify that "make [...] install" will do what you want.
132buildsetup-tell:
133 @echo VPATH is set to: \"$(VPATH)\"
134 @echo prefix is set to: \"$(prefix)\"
135 @echo -e INCPATH,LIBPATH, etc. are set to:'\n' \
136 $(addprefix $(D),$(INCPATH)'\n' $(LIBPATH)'\n' $(BINPATH)'\n' \
137 $(MANPATH)'\n' $(MAN3PATH)'\n' $(MAN5PATH)'\n')'\n'
138
139libpng.pc: scripts/libpng.pc.in
140 @echo -e Making pkg-config file for this libpng installation..'\n' \
141 using PREFIX=\"$(prefix)\"'\n'
142 cat $(S)/scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
143 sed -e s/-lm// > libpng.pc
144
145libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
146 @echo -e Making $(LIBNAME) libpng-config file for this libpng \
147 installation..'\n' using PREFIX=\"$(prefix)\"'\n'
148 ( cat $(S)/scripts/libpng-config-head.in; \
149 echo prefix=\"$(prefix)\"; \
150 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
151 echo cflags=\"\"; \
152 echo ldflags=\"-L$(LIBPATH)\"; \
153 echo libs=\"-lpng$(PNGMAJ) -lz\"; \
154 cat $(S)/scripts/libpng-config-body.in ) > libpng-config
155 chmod +x libpng-config
156
157static: all-static
158shared: all-shared
159all-static: $(STATLIB) pngtest-stat$(EXE)
160all-shared: $(SHAREDLIB) pngtest$(EXE)
161
162pnggccrd.o: pnggccrd.c png.h pngconf.h
163 @echo ""
164 @echo ' You can ignore the "control reaches end of non-void function"'
165 @echo ' warning and "<variable> defined but not used" warnings:'
166 @echo ""
167 $(CC) -c $(CFLAGS) -o $@ $<
168
169pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
170 @echo ""
171 @echo ' You can ignore the "control reaches end of non-void function"'
172 @echo ' warning and "<variable> defined but not used" warnings:'
173 @echo ""
174 $(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
175
176$(STATLIB): $(OBJS)
177 ar rc $@ $(OBJS)
178 $(RANLIB) $@
179
180$(SHAREDDEF): projects/msvc/png32ms.def
181 cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
182 sed -e 's/\([^;]*\);/;/' > $@
183
184$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
185 $(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
186
187pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
188 $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
189
190pngtest-stat$(EXE): pngtest.o $(STATLIB)
191 $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
192
193pngtest.pic.o: pngtest.c
194 $(CC) $(CFLAGS) -c $< -o $@
195
196pngtest.o: pngtest.c
197 $(CC) $(CFLAGS) -c $< -o $@
198
199test: test-static test-shared
200
201test-static: pngtest-stat$(EXE)
202 ./pngtest-stat $(S)/pngtest.png
203
204test-shared: pngtest$(EXE)
205 ./pngtest $(S)/pngtest.png
206
207install-static: $(STATLIB) install-headers install-man
208 -@if [ ! -d $(DL) ]; then $(MKDIR) $(DL); fi
209 install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
210 -@rm -f $(DL)/$(STATLIB)
211 (cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
212
213install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
214 -@if [ ! -d $(DL) ]; then $(MKDIR) $(DL); fi
215 -@if [ ! -d $(DB) ]; then $(MKDIR) $(DB); fi
216 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR) $(DL)/pkgconfig; fi
217 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
218 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
219 install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
220 -@rm -f $(DL)/$(IMPLIB)
221 (cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
222 install -s -m 755 $(SHAREDLIB) $(DB)
223 install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
224 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
225
226install-headers:
227 -@if [ ! -d $(DI) ]; then $(MKDIR) $(DI); fi
228 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR) $(DI)/$(LIBNAME); fi
229 -@rm -f $(DI)/png.h
230 -@rm -f $(DI)/pngconf.h
231 install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
232 -@rm -f $(DI)/libpng
233 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
234
235install-man:
236 -@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR) $(D)$(MAN3PATH); fi
237 -@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR) $(D)$(MAN5PATH); fi
238 install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
239 install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
240
241install-config: libpng-config
242 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
243 -@/bin/rm -f $(DB)/libpng-config
244 -@/bin/rm -f $(DB)/$(LIBNAME)-config
245 cp libpng-config $(DB)/$(LIBNAME)-config
246 chmod 755 $(DB)/$(LIBNAME)-config
247 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
248
249# Run this to verify that a future `configure' run will pick up the settings
250# you want.
251test-config-install: SHELL=/bin/bash
252test-config-install: $(DB)/libpng-config
253 @echo -e Testing libpng-config functions...'\n'
254 @ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
255 do \
256 printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
257 "$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
258 gytiu=$$(( $$gytiu + 1 )); \
259 done
260
261install: install-static install-shared install-man install-config
262
263# If you installed in $(DESTDIR), test-installed won't work until you
264# move the library to its final location.
265
266test-installed:
267 $(CC) $(CFLAGS) \
268 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
269 -L$(ZLIBLIB) \
270 -o pngtesti$(EXE) `$(BINPATH)/libpng12-config --ldflags --libs`
271 ./pngtesti$(EXE) pngtest.png
272
273clean:
274 /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
275 pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
276 libpng-config libpng.pc pngtesti$(EXE)
277
278DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
279writelock:
280 chmod a-w *.[ch35] $(DOCS) scripts/*
281
282.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
283
284# DO NOT DELETE THIS LINE -- make depend depends on it.
285
286png.o png.pic.o: png.h pngconf.h png.c
287pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
288pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
289pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
290pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
291pngset.o pngset.pic.o: png.h pngconf.h pngset.c
292pngget.o pngget.pic.o: png.h pngconf.h pngget.c
293pngread.o pngread.pic.o: png.h pngconf.h pngread.c
294pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
295pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
296pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
297pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
298pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
299pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
300pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
301
302pngtest.o: png.h pngconf.h pngtest.c
303pngtest-stat.o: png.h pngconf.h pngtest.c
304
305
306