source: trunk/src/3rdparty/libpng/scripts/makefile.cygwin

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 9.1 KB
Line 
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, 2006-2008 Soren Anderson, Charles Wilson,
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#
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# 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
64CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
65 -W -Wall -O3 $(ALIGN) -funroll-loops \
66 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
67
68LIBNAME = libpng14
69PNGMAJ = 14
70CYGDLL = 14
71PNGMIN = 1.4.0
72PNGVER = $(PNGMAJ).$(PNGMIN)
73
74SHAREDLIB=cygpng$(CYGDLL).dll
75STATLIB=libpng.a
76IMPLIB=libpng.dll.a
77SHAREDDEF=libpng.def
78LIBS=$(SHAREDLIB) $(STATLIB)
79EXE=.exe
80
81LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
82LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
83LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
84
85MKDIR_P=/bin/mkdir -pv
86RANLIB=ranlib
87#RANLIB=echo
88
89INCPATH=$(prefix)/include
90LIBPATH=$(exec_prefix)/lib
91
92BINPATH=$(exec_prefix)/bin
93MANPATH=$(prefix)/man
94MAN3PATH=$(MANPATH)/man3
95MAN5PATH=$(MANPATH)/man5
96
97# cosmetic: shortened strings:
98S =$(SRCDIR)
99D =$(DESTDIR)
100DB =$(D)$(BINPATH)
101DI =$(D)$(INCPATH)
102DL =$(D)$(LIBPATH)
103
104OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
105 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
106 pngwtran.o pngmem.o pngerror.o pngpread.o
107
108OBJSDLL = $(OBJS:.o=.pic.o)
109
110.SUFFIXES: .c .o .pic.o
111
112%.o : %.c
113 $(CC) -c $(CFLAGS) -o $@ $<
114%.pic.o : CFLAGS += -DPNG_BUILD_DLL
115%.pic.o : %.c
116 $(CC) -c $(CFLAGS) -o $@ $<
117
118all: all-static all-shared libpng.pc libpng-config libpng.pc libpng-config
119
120# Make this to verify that "make [...] install" will do what you want.
121buildsetup-tell:
122 @echo VPATH is set to: \"$(VPATH)\"
123 @echo prefix is set to: \"$(prefix)\"
124 @echo -e INCPATH,LIBPATH, etc. are set to:'\n' \
125 $(addprefix $(D),$(INCPATH)'\n' $(LIBPATH)'\n' $(BINPATH)'\n' \
126 $(MANPATH)'\n' $(MAN3PATH)'\n' $(MAN5PATH)'\n')'\n'
127
128libpng.pc: scripts/libpng.pc.in
129 @echo -e Making pkg-config file for this libpng installation..'\n' \
130 using PREFIX=\"$(prefix)\"'\n'
131 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
132 -e s!@exec_prefix@!$(exec_prefix)! \
133 -e s!@libdir@!$(LIBPATH)! \
134 -e s!@includedir@!$(INCPATH)! \
135 -e s!-lpng14!-lpng14\ -lz! > libpng.pc
136
137libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
138 @echo -e Making $(LIBNAME) libpng-config file for this libpng \
139 installation..'\n' using PREFIX=\"$(prefix)\"'\n'
140 ( cat $(S)/scripts/libpng-config-head.in; \
141 echo prefix=\"$(prefix)\"; \
142 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
143 echo L_opts=\"-L$(LIBPATH)\"; \
144 echo libs=\"-lpng$(CYGDLL) -lz\"; \
145 cat $(S)/scripts/libpng-config-body.in ) > libpng-config
146 chmod +x libpng-config
147
148static: all-static
149shared: all-shared
150all-static: $(STATLIB) pngtest-stat$(EXE)
151all-shared: $(SHAREDLIB) pngtest$(EXE)
152
153$(STATLIB): $(OBJS)
154 ar rc $@ $(OBJS)
155 $(RANLIB) $@
156
157$(SHAREDDEF): scripts/pngwin.def
158 cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
159 sed -e 's/\([^;]*\);/;/' > $@
160
161$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
162 $(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
163
164pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
165 $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
166
167pngtest-stat$(EXE): pngtest.o $(STATLIB)
168 $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
169
170pngtest.pic.o: pngtest.c
171 $(CC) $(CFLAGS) -c $< -o $@
172
173pngtest.o: pngtest.c png.h pngconf.h
174 $(CC) $(CFLAGS) -c $< -o $@
175
176test: test-static test-shared
177
178test-static: pngtest-stat$(EXE)
179 ./pngtest-stat $(S)/pngtest.png
180
181test-shared: pngtest$(EXE)
182 ./pngtest $(S)/pngtest.png
183
184install-static: $(STATLIB) install-headers install-man
185 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
186 install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
187 -@rm -f $(DL)/$(STATLIB)
188 (cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
189
190install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
191 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
192 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
193 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
194 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
195 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
196 install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
197 -@rm -f $(DL)/$(IMPLIB)
198 (cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
199 install -s -m 755 $(SHAREDLIB) $(DB)
200 install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
201 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
202
203install-headers:
204 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
205 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
206 -@rm -f $(DI)/png.h
207 -@rm -f $(DI)/pngconf.h
208 install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
209 -@rm -f $(DI)/libpng
210 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
211
212install-man:
213 -@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR_P) $(D)$(MAN3PATH); fi
214 -@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR_P) $(D)$(MAN5PATH); fi
215 install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
216 install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
217
218install-config: libpng-config
219 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
220 -@/bin/rm -f $(DB)/libpng-config
221 -@/bin/rm -f $(DB)/$(LIBNAME)-config
222 cp libpng-config $(DB)/$(LIBNAME)-config
223 chmod 755 $(DB)/$(LIBNAME)-config
224 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
225
226# Run this to verify that a future `configure' run will pick up the settings
227# you want.
228test-config-install: SHELL=/bin/bash
229test-config-install: $(DB)/libpng-config
230 @echo -e Testing libpng-config functions...'\n'
231 @ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
232 do \
233 printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
234 "$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
235 gytiu=$$(( $$gytiu + 1 )); \
236 done
237
238install: install-static install-shared install-man install-config
239
240# If you installed in $(DESTDIR), test-installed won't work until you
241# move the library to its final location. Use test-dd to test it
242# before then.
243
244test-dd:
245 echo
246 echo Testing installed dynamic shared library in $(DL).
247 $(CC) -I$(DI) $(CFLAGS) \
248 `$(BINPATH)/libpng14-config --cflags` pngtest.c \
249 -L$(DL) -L$(ZLIBLIB) \
250 -o pngtestd `$(BINPATH)/libpng14-config --ldflags`
251 ./pngtestd pngtest.png
252
253test-installed:
254 $(CC) $(CFLAGS) \
255 `$(BINPATH)/libpng14-config --cflags` pngtest.c \
256 -L$(ZLIBLIB) \
257 -o pngtesti$(EXE) `$(BINPATH)/libpng14-config --ldflags`
258 ./pngtesti$(EXE) pngtest.png
259
260clean:
261 /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
262 pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
263 libpng-config libpng.pc pngtesti$(EXE)
264
265DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
266writelock:
267 chmod a-w *.[ch35] $(DOCS) scripts/*
268
269.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
270
271# DO NOT DELETE THIS LINE -- make depend depends on it.
272
273png.o png.pic.o: png.h pngconf.h pngpriv.h png.c
274pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngerror.c
275pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngrio.c
276pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngwio.c
277pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngmem.c
278pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngset.c
279pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngget.c
280pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngread.c
281pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngrtran.c
282pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngrutil.c
283pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngtrans.c
284pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngwrite.c
285pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngwtran.c
286pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngwutil.c
287pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngpread.c
288
289pngtest.o: png.h pngconf.h pngtest.c
290pngtest-stat.o: png.h pngconf.h pngtest.c
291
292
293
Note: See TracBrowser for help on using the repository browser.