VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.8/scripts/makefile.cygwin@ 41883

Last change on this file since 41883 was 6395, checked in by vboxsync, 17 years ago

export libpng and zlib so Windows and OS/2 build cleanly.

  • Property svn:eol-style set to native
File size: 10.0 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 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
81CYGDLL = 12
82PNGMIN = 1.2.8
83PNGVER = $(PNGMAJ).$(PNGMIN)
84
85SHAREDLIB=cygpng$(CYGDLL).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 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
156static: all-static
157shared: all-shared
158all-static: $(STATLIB) pngtest-stat$(EXE)
159all-shared: $(SHAREDLIB) pngtest$(EXE)
160
161pnggccrd.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
168pnggccrd.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): scripts/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
186pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
187 $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
188
189pngtest-stat$(EXE): pngtest.o $(STATLIB)
190 $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
191
192pngtest.pic.o: pngtest.c
193 $(CC) $(CFLAGS) -c $< -o $@
194
195pngtest.o: pngtest.c
196 $(CC) $(CFLAGS) -c $< -o $@
197
198test: test-static test-shared
199
200test-static: pngtest-stat$(EXE)
201 ./pngtest-stat $(S)/pngtest.png
202
203test-shared: pngtest$(EXE)
204 ./pngtest $(S)/pngtest.png
205
206install-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
212install-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
225install-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
234install-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
240install-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.
250test-config-install: SHELL=/bin/bash
251test-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
260install: 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. Use test-dd to test it
264# before then.
265
266test-dd:
267 echo
268 echo Testing installed dynamic shared library in $(DL).
269 $(CC) -I$(DI) $(CFLAGS) \
270 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
271 -L$(DL) -L$(ZLIBLIB) \
272 -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
273 ./pngtestd pngtest.png
274
275test-installed:
276 $(CC) $(CFLAGS) \
277 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
278 -L$(ZLIBLIB) \
279 -o pngtesti$(EXE) `$(BINPATH)/libpng12-config --ldflags`
280 ./pngtesti$(EXE) pngtest.png
281
282clean:
283 /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
284 pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
285 libpng-config libpng.pc pngtesti$(EXE)
286
287DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
288writelock:
289 chmod a-w *.[ch35] $(DOCS) scripts/*
290
291.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
292
293# DO NOT DELETE THIS LINE -- make depend depends on it.
294
295png.o png.pic.o: png.h pngconf.h png.c
296pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
297pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
298pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
299pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
300pngset.o pngset.pic.o: png.h pngconf.h pngset.c
301pngget.o pngget.pic.o: png.h pngconf.h pngget.c
302pngread.o pngread.pic.o: png.h pngconf.h pngread.c
303pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
304pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
305pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
306pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
307pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
308pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
309pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
310
311pngtest.o: png.h pngconf.h pngtest.c
312pngtest-stat.o: png.h pngconf.h pngtest.c
313
314
315
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette