]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.msys
Move code removing "-psn_xxx" command line arguments to common code.
[wxWidgets.git] / src / png / scripts / makefile.msys
1 # makefile for libpng using MSYS/gcc (shared, static library)
2 # Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
3 #
4 # Portions taken from makefile.linux:
5 # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and
6 # Glenn Randers-Pehrson
7 # Copyright (C) 2000 Cosmin Truta
8 # Copyright (C) 1996, 1997 Andreas Dilger
9 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
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 prefix=/usr/local
16 exec_prefix=$(prefix)
17
18 # Library name:
19 LIBNAME = libpng16
20 PNGMAJ = 16
21 RELEASE = 2
22
23 # Shared library names:
24 LIBSO=$(LIBNAME).dll
25 LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ)
26 LIBSOREL=$(PNGMAJ).$(RELEASE)
27 OLDSO=libpng.dll
28
29 # Where the zlib library and include files are located.
30 #ZLIBLIB=../zlib
31 #ZLIBINC=../zlib
32 ZLIBLIB=/usr/local/lib
33 ZLIBINC=/usr/local/include
34
35 # Compiler, linker, lib and other tools
36 CC = gcc
37 LD = $(CC)
38 AR_RC = ar rcs
39 RANLIB = ranlib
40 RM_F = rm -rf
41 MKDIR_P=mkdir -p
42 LN_SF=ln -sf
43
44 #ARCH = -march=pentium3
45 #ARCH = -march=i686
46 ARCH =
47 CDEBUG = -g -DPNG_DEBUG=5
48 LDDEBUG =
49 CRELEASE = -O2
50 LDRELEASE = -s
51 #CFLAGS = -W -Wall $(CDEBUG)
52 CFLAGS = -W -Wall $(CRELEASE) $(ARCH)
53 #LDFLAGS = $(LDDEBUG)
54 LDFLAGS = $(LDRELEASE)
55 LIBS = -lz -lm
56
57 # File extensions
58 O=.o
59 A=.a
60 EXE=.exe
61
62 INCPATH=$(prefix)/include
63 LIBPATH=$(exec_prefix)/lib
64 MANPATH=$(prefix)/man
65 BINPATH=$(exec_prefix)/bin
66
67 # override DESTDIR= on the make install command line to easily support
68 # installing into a temporary location. Example:
69 #
70 # make install DESTDIR=/tmp/build/libpng
71 #
72 # If you're going to install into a temporary location
73 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
74 # you execute make install.
75
76 DESTDIR=
77
78 DB=$(DESTDIR)$(BINPATH)
79 DI=$(DESTDIR)$(INCPATH)
80 DL=$(DESTDIR)$(LIBPATH)
81 DM=$(DESTDIR)$(MANPATH)
82
83 # Variables
84 OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
85 pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
86 pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
87
88 # Targets
89 all: static shared
90
91 # see scripts/pnglibconf.mak for more options
92 pnglibconf.h: scripts/pnglibconf.h.prebuilt
93 cp scripts/pnglibconf.h.prebuilt $@
94
95 .c$(O):
96 $(CC) -c $(CFLAGS) -I$(ZLIBINC) $<
97
98 static: libpng$(A) pngtest$(EXE)
99
100 shared: $(LIBSOMAJ)
101 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
102
103 $(LIBSO): $(LIBSOMAJ)
104 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
105
106 $(LIBSOMAJ):
107 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
108
109 libpng$(A): $(OBJS)
110 $(AR_RC) $@ $(OBJS)
111 $(RANLIB) $@
112
113 install-headers: png.h pngconf.h pnglibconf.h
114 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
115 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
116 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
117 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
118 -@$(RM_F) $(DI)/libpng
119 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
120
121 install-static: install-headers libpng.a
122 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
123 cp libpng.a $(DL)/$(LIBNAME).a
124 -@$(RM_F) $(DL)/libpng.a
125 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
126
127 libpng.pc:
128 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
129 -e s!@exec_prefix@!$(exec_prefix)! \
130 -e s!@libdir@!$(LIBPATH)! \
131 -e s!@includedir@!$(INCPATH)! \
132 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
133
134 libpng-config:
135 ( cat scripts/libpng-config-head.in; \
136 echo prefix=\"$(prefix)\"; \
137 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
138 echo L_opts=\"-L$(LIBPATH)\"; \
139 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
140 echo libs=\"-lpng16 -lz -lm\"; \
141 cat scripts/libpng-config-body.in ) > libpng-config
142
143 install-shared: install-headers $(LIBSOMAJ) libpng.pc
144 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
145 -@$(RM_F) $(DL)/$(LIBSO)
146 -@$(RM_F) $(DL)/$(OLDSO)
147 cp $(LIBSO) $(DL)/$(LIBSOREL)
148 (cd $(DL); \
149 $(LN_SF) $(LIBSOREL) $(LIBSO); \
150 $(LN_SF) $(LIBSO) $(OLDSO))
151
152 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
153 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
154 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
155 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
156 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
157
158 install-man: libpng.3 libpngpf.3 png.5
159 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
160 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
161 -@$(RM_F) $(DM)/man3/libpng.3
162 -@$(RM_F) $(DM)/man3/libpngpf.3
163 cp libpng.3 $(DM)/man3
164 cp libpngpf.3 $(DM)/man3
165 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
166 -@$(RM_F) $(DM)/man5/png.5
167 cp png.5 $(DM)/man5
168
169 install-config: libpng-config
170 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
171 -@$(RM_F) $(DB)/libpng-config
172 -@$(RM_F) $(DB)/$(LIBNAME)-config
173 cp libpng-config $(DB)/$(LIBNAME)-config
174 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
175
176 install: install-static install-shared install-man install-config
177
178 test: pngtest$(EXE)
179 ./pngtest$(EXE)
180
181 pngtest$(EXE): pngtest$(O) libpng$(A)
182 $(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest$(O) libpng$(A) $(LIBS)
183
184 clean:
185 $(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png pnglibconf.h $(LIBSO) \
186 $(LIBSOMAJ) libpng-config
187
188 png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
189 pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
190 pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
191 pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
192 pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
193 pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
194 pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
195 pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
196 pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
197 pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
198 pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
199 pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
200 pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
201 pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
202 pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
203
204 pngtest$(O): png.h pngconf.h pnglibconf.h