]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.cygwin
This commit was generated by cvs2svn to compensate for changes in r28944,
[wxWidgets.git] / src / png / scripts / makefile.cygwin
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
17 ifdef SRCDIR
18 VPATH = $(SRCDIR)
19 else
20 SRCDIR = .
21 endif
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
32 DESTDIR=
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
38 CC=gcc
39 ifdef MINGW
40 MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
41 MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
42 endif
43
44 # Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
45 ifndef prefix
46 prefix=/usr
47 $(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
48 endif
49
50 # Where the zlib library and include files are located
51 ZLIBLIB= /usr/lib
52 ZLIBINC=
53 #ZLIBLIB=../zlib
54 #ZLIBINC=../zlib
55
56 ALIGN=
57 # for i386:
58 #ALIGN=-malign-loops=2 -malign-functions=2
59
60 WARNMORE=-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
75 CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
76 -Wall -O3 $(ALIGN) -funroll-loops \
77 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
78
79 LIBNAME = libpng12
80 PNGMAJ = 0
81 CYGDLL = 12
82 PNGMIN = 1.2.6
83 PNGVER = $(PNGMAJ).$(PNGMIN)
84
85 SHAREDLIB=cygpng$(CYGDLL).dll
86 STATLIB=libpng.a
87 IMPLIB=libpng.dll.a
88 SHAREDDEF=libpng.def
89 LIBS=$(SHAREDLIB) $(STATLIB)
90 EXE=.exe
91
92 LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
93 LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
94 LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
95
96 MKDIR=/bin/mkdir -pv
97 RANLIB=ranlib
98 #RANLIB=echo
99
100 INCPATH=$(prefix)/include
101 LIBPATH=$(prefix)/lib
102
103 BINPATH=$(prefix)/bin
104 MANPATH=$(prefix)/man
105 MAN3PATH=$(MANPATH)/man3
106 MAN5PATH=$(MANPATH)/man5
107
108 # cosmetic: shortened strings:
109 S =$(SRCDIR)
110 D =$(DESTDIR)
111 DB =$(D)$(BINPATH)
112 DI =$(D)$(INCPATH)
113 DL =$(D)$(LIBPATH)
114
115 OBJS = 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
119 OBJSDLL = $(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
129 all: 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.
132 buildsetup-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
139 libpng.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
145 libpng-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 I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
151 echo L_opts=\"-L$(LIBPATH)\"; \
152 echo libs=\"-lpng$(CYGDLL) -lz\"; \
153 cat $(S)/scripts/libpng-config-body.in ) > libpng-config
154 chmod +x libpng-config
155
156 static: all-static
157 shared: all-shared
158 all-static: $(STATLIB) pngtest-stat$(EXE)
159 all-shared: $(SHAREDLIB) pngtest$(EXE)
160
161 pnggccrd.o: pnggccrd.c png.h pngconf.h
162 @echo ""
163 @echo ' You can ignore the "control reaches end of non-void function"'
164 @echo ' warning and "<variable> defined but not used" warnings:'
165 @echo ""
166 $(CC) -c $(CFLAGS) -o $@ $<
167
168 pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
169 @echo ""
170 @echo ' You can ignore the "control reaches end of non-void function"'
171 @echo ' warning and "<variable> defined but not used" warnings:'
172 @echo ""
173 $(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
174
175 $(STATLIB): $(OBJS)
176 ar rc $@ $(OBJS)
177 $(RANLIB) $@
178
179 $(SHAREDDEF): projects/msvc/png32ms.def
180 cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
181 sed -e 's/\([^;]*\);/;/' > $@
182
183 $(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
184 $(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
185
186 pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
187 $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
188
189 pngtest-stat$(EXE): pngtest.o $(STATLIB)
190 $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
191
192 pngtest.pic.o: pngtest.c
193 $(CC) $(CFLAGS) -c $< -o $@
194
195 pngtest.o: pngtest.c
196 $(CC) $(CFLAGS) -c $< -o $@
197
198 test: test-static test-shared
199
200 test-static: pngtest-stat$(EXE)
201 ./pngtest-stat $(S)/pngtest.png
202
203 test-shared: pngtest$(EXE)
204 ./pngtest $(S)/pngtest.png
205
206 install-static: $(STATLIB) install-headers install-man
207 -@if [ ! -d $(DL) ]; then $(MKDIR) $(DL); fi
208 install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
209 -@rm -f $(DL)/$(STATLIB)
210 (cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
211
212 install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
213 -@if [ ! -d $(DL) ]; then $(MKDIR) $(DL); fi
214 -@if [ ! -d $(DB) ]; then $(MKDIR) $(DB); fi
215 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR) $(DL)/pkgconfig; fi
216 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
217 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
218 install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
219 -@rm -f $(DL)/$(IMPLIB)
220 (cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
221 install -s -m 755 $(SHAREDLIB) $(DB)
222 install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
223 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
224
225 install-headers:
226 -@if [ ! -d $(DI) ]; then $(MKDIR) $(DI); fi
227 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR) $(DI)/$(LIBNAME); fi
228 -@rm -f $(DI)/png.h
229 -@rm -f $(DI)/pngconf.h
230 install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
231 -@rm -f $(DI)/libpng
232 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
233
234 install-man:
235 -@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR) $(D)$(MAN3PATH); fi
236 -@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR) $(D)$(MAN5PATH); fi
237 install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
238 install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
239
240 install-config: libpng-config
241 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
242 -@/bin/rm -f $(DB)/libpng-config
243 -@/bin/rm -f $(DB)/$(LIBNAME)-config
244 cp libpng-config $(DB)/$(LIBNAME)-config
245 chmod 755 $(DB)/$(LIBNAME)-config
246 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
247
248 # Run this to verify that a future `configure' run will pick up the settings
249 # you want.
250 test-config-install: SHELL=/bin/bash
251 test-config-install: $(DB)/libpng-config
252 @echo -e Testing libpng-config functions...'\n'
253 @ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
254 do \
255 printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
256 "$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
257 gytiu=$$(( $$gytiu + 1 )); \
258 done
259
260 install: install-static install-shared install-man install-config
261
262 # If you installed in $(DESTDIR), test-installed won't work until you
263 # move the library to its final location.
264
265 test-installed:
266 $(CC) $(CFLAGS) \
267 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
268 -L$(ZLIBLIB) \
269 -o pngtesti$(EXE) `$(BINPATH)/libpng12-config --ldflags`
270 ./pngtesti$(EXE) pngtest.png
271
272 clean:
273 /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
274 pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
275 libpng-config libpng.pc pngtesti$(EXE)
276
277 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
278 writelock:
279 chmod a-w *.[ch35] $(DOCS) scripts/*
280
281 .PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
282
283 # DO NOT DELETE THIS LINE -- make depend depends on it.
284
285 png.o png.pic.o: png.h pngconf.h png.c
286 pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
287 pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
288 pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
289 pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
290 pngset.o pngset.pic.o: png.h pngconf.h pngset.c
291 pngget.o pngget.pic.o: png.h pngconf.h pngget.c
292 pngread.o pngread.pic.o: png.h pngconf.h pngread.c
293 pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
294 pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
295 pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
296 pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
297 pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
298 pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
299 pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
300
301 pngtest.o: png.h pngconf.h pngtest.c
302 pngtest-stat.o: png.h pngconf.h pngtest.c
303
304
305