VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.54/scripts/makefile.mingw@ 78343

Last change on this file since 78343 was 58796, checked in by vboxsync, 9 years ago

libpng 1.2.54 unmodified

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