-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextra.mk
More file actions
303 lines (266 loc) · 9.8 KB
/
extra.mk
File metadata and controls
303 lines (266 loc) · 9.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# ----------------------------------------------------------------------------
#
# DicomSel: DICOM Image Selector
#
# Copyright (C) 2005, 2006 IRCAD
# Authors: Benjamin Gaillard, Marc-Aurèle Mörk, Guillaume Spitz
#
# ----------------------------------------------------------------------------
#
# << LICENSE >>
#
# ----------------------------------------------------------------------------
RM = rm -f
CP = cp -fp
MV = mv -f
WINE = env -i WINEDEBUG=-all wine
MACX86CC = gcc-4.0 -arch i386
MACPPCCC = gcc-3.3 -arch ppc
MACX86CXX = g++-4.0 -arch i386
MACPPCCXX = g++-3.3 -arch ppc
CFLAGS = -O2 -fomit-frame-pointer -pipe
CXXFLAGS = $(CFLAGS) -fno-rtti
X86FLAGS = -march=i386 -mtune=i686
MACX86CFLAGS = -march=prescott -mfpmath=sse -mmacosx-version-min=10.4
MACX86CPPFLAGS = -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -nostdinc \
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0 \
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/i686-apple-darwin8 \
-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include
MACX86LDFLAGS = -mmacosx-version-min=10.4 \
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
MACPPCCFLAGS = -mcpu=750 -mtune=7450
MACPPCCPPFLAGS = -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc \
-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++ \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin \
-isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include
MACPPCLDFLAGS = -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk
BINDIR = bin
BUILDDIR = build
WXMSW = wxmsw
WXMSWMINGW = $(WXMSW)/mingw
WXMSWMSVC = $(WXMSW)/msvc
WXMAC = wxmac
WXMACX86 = $(WXMAC)/x86
WXMACPPC = $(WXMAC)/ppc
# --disable-threads (after --disable-unicode) removed
# may make the mingw version require an additional dll...
WXCFG_FLAGS = --disable-shared --enable-no_rtti --enable-no_exceptions \
--enable-no_deps --disable-compat24 --disable-rpath \
--disable-protocol \
--disable-html --disable-xrc --disable-debugreport \
--disable-postscript --disable-calendar --disable-datepick \
--disable-grid --disable-help --disable-joystick \
--disable-sash --disable-sound --disable-splash \
--disable-tipdlg --disable-wizarddlg --disable-gif \
--disable-pnm --disable-pcx --without-libpng --without-libjpeg \
--without-libtiff --without-regex --without-zlib --without-expat
WXCFG_MSW = --with-msw --disable-sockets --disable-unicode
WXCFG_MAC = --with-mac --enable-unicode
EMF = -f extra.mk
.PHONY: default all autogen autoclean conf clean head
.PHONY: dist bindist wxsrc bin linux win32 win32-mingw win32-msc mac
default: all
all:
$(MAKE) $(EMF) dist
$(MAKE) $(EMF) bindist
$(MAKE) $(EMF) autoclean
configure: configure.ac
$(MAKE) $(EMF) autogen
autogen:
test -d autotools || mkdir autotools
aclocal-1.10 -I aclocal || aclocal -I aclocal
autoconf-2.60 || autoconf
autoheader-2.60 || autoheader
automake-1.10 -a -c || automake -a -c
autoclean:
test ! -f Makefile || make distclean
rm -rf autom4te.cache config.h.in aclocal.m4 configure autotools \
`find . -name Makefile.in | grep -v ^\\./3rdparty`
conf:
./configure CFLAGS="$(X86FLAGS) $(CFLAGS)" \
CXXFLAGS="$(X86FLAGS) $(CXXFLAGS)" LDFLAGS="-s"
dist: configure
./configure
$(MAKE) dist-bzip2
$(MAKE) distclean
bin:
$(MAKE) $(EMF) linux
$(MAKE) $(EMF) win32
bin.zip: bin
find $< | LC_ALL=C sort | zip -9 -@ $@
bindist: bin.zip
rm -rf bin
linux: $(BINDIR)/linux
$(BINDIR)/linux: configure
test -d $(BINDIR) || mkdir $(BINDIR)
@echo "===================== Building for Linux ====================="
./configure CFLAGS="$(X86FLAGS) $(CFLAGS)" \
CXXFLAGS="$(X86FLAGS) $(CXXFLAGS)" LDFLAGS="-s"
$(MAKE)
test -d $(BINDIR)/linux || mkdir -p $(BINDIR)/linux
$(CP) src/dicomsel $(BINDIR)/linux
$(MAKE) distclean
win32: $(BINDIR)/win32
$(BINDIR)/win32:
@echo "==================== Building for Windows ===================="
$(MAKE) -f extra.mk win32-msc || $(MAKE) -f extra.mk win32-mingw
win32-mingw: configure $(WXMSWMINGW)
./configure --host=mingw32 --target=mingw32 \
--with-wx-prefix=$(PWD)/$(WXMSWMINGW) \
CFLAGS="$(X86FLAGS) $(CFLAGS)" \
CXXFLAGS="$(X86FLAGS) $(CXXFLAGS)" \
CPPFLAGS="-DLITTLE_ENDIAN=1234 -DBIG_ENDIAN=4321 \
-DBYTE_ORDER=1234" LDFLAGS="-s"
$(MAKE)
test -d $(BINDIR)/win32 || mkdir -p $(BINDIR)/win32
$(CP) src/dicomsel.exe $(BINDIR)/win32
$(MAKE) distclean
win32-msc: msvc/config.h $(WXMSWMSVC)
$(MAKE) $(EMF) msvc/flags.mak
$(WINE) nmake /NOLOGO /f Makefile.msc
test -d $(BINDIR)/win32 || mkdir -p $(BINDIR)/win32
$(CP) src/dicomsel.exe $(BINDIR)/win32
$(WINE) nmake /NOLOGO /f Makefile.msc clean
msvc/config.h msvc/flags.mak: msvc/config.h.in msvc/flags.mak.in configure.ac
$(MAKE) -f extra.mk configure
./configure
$(CP) msvc/config.h msvc/config.h.save
$(CP) msvc/flags.mak msvc/flags.mak.save
$(MAKE) distclean
$(MV) msvc/config.h.save msvc/config.h
$(MV) msvc/flags.mak.save msvc/flags.mak
mac: $(BINDIR)/mac/DicomSel.app
$(BINDIR)/mac/DicomSel.app: configure $(WXMAC)
@echo "=================== Building for Mac OS X ===================="
rm -fr $@
mkdir -p $@
./configure CC="$(MACX86CC)" CXX="$(MACX86CXX)" \
CFLAGS="$(MACX86CFLAGS) $(CFLAGS)" \
CXXFLAGS="$(MACX86CFLAGS) $(CXXFLAGS)" \
CPPFLAGS="$(MACX86CPPFLAGS)" \
LDFLAGS="$(MACX86LDFLAGS)" \
--with-wx-config=`pwd`/$(WXMACX86)/bin/wx-config
$(MAKE)
$(CP) src/dicomsel $@/dicomsel.x86
$(MAKE) distclean
./configure CC="$(MACPPCCC)" CXX="$(MACPPCCXX)" \
CFLAGS="$(MACPPCCFLAGS) $(CFLAGS)" \
CXXFLAGS="$(MACPPCCFLAGS) $(CXXFLAGS)" \
CPPFLAGS="$(MACPPCCPPFLAGS)" \
LDFLAGS="$(MACPPCLDFLAGS)" \
--with-wx-config=`pwd`/$(WXMACPPC)/bin/wx-config
$(MAKE)
$(CP) src/dicomsel $@/dicomsel.ppc
@echo "Creating Mac OS X .app directories under $(BINDIR)/mac..."
mkdir $@/Contents
$(CP) src/Info.plist $@/Contents
mkdir $@/Contents/MacOS
lipo -create $@/dicomsel.x86 $@/dicomsel.ppc \
-output $@/Contents/MacOS/dicomsel
strip -ur $@/Contents/MacOS/dicomsel
echo -n "APPL????" > $@/Contents/PkgInfo
mkdir $@/Contents/Resources
$(CP) src/images/icon.icns $@/Contents/Resources
rm -f $@/dicomsel.x86 $@/dicomsel.ppc
$(MAKE) distclean
clean:
@echo "Deleting distribution directory..."
$(RM) -r $(BINDIR) $(WXMSW) $(WXMAC) $(BUILDDIR)
head: head/info.txt
@echo "Regenerating files head..."
/bin/bash tools/gencom.sh -i head/info.txt -l head/license.txt \
configure.ac Makefile.am extra.mk rc.am doc/Makefile.am \
libdicom/Makefile.am libdicom/src/Makefile.am \
Makefile.msc libdicom/src/Makefile.msc msvc/flags.mak \
src include rfsample
head/info.txt: head/info.txt.in configure.ac
$(MAKE) -f extra.mk configure
./configure
$(CP) $@ $@.save
$(MAKE) distclean
$(MV) $@.save $@
wxsrc: $(WXSRC)
@if test -z "$<" -o ! -f "$<"; then \
echo "********************************************************"; \
echo "* You must specify the wxWidgets sources archive"; \
echo "* location through the WXSRC variable, like this:"; \
echo "* $(MAKE) WXSRC=/path/to/sources.tar.bz2 <target>"; \
echo "* Also make sure you have MinGW installed if you"; \
echo "* cross-compile wxWidgets for Windows under Linux."; \
echo "********************************************************"; \
exit 1; \
fi
$(BUILDDIR): $(WXSRC)
$(MAKE) $(EMF) wxsrc
rm -fr $@
mkdir -p $@
tar -xjf $(WXSRC) -C $@
$(WXMSWMINGW): $(BUILDDIR)
@echo "Compiling wxWidgets for Windows..."
rm -fr $@
mkdir -p $@
CWD=`pwd`; cd $(BUILDDIR)/wx* && \
./configure --prefix="$$CWD/$@" \
--host=mingw32 --target=mingw32 \
CFLAGS="$(X86FLAGS) $(CFLAGS)" \
CXXFLAGS="$(X86FLAGS) $(CXXFLAGS)" \
$(WXCFG_FLAGS) $(WXCFG_MSW)
$(MAKE) -C $(BUILDDIR)/wx* all
$(MAKE) -C $(BUILDDIR)/wx* install
$(MAKE) -C $(BUILDDIR)/wx* distclean
rm -f $(BUILDDIR)/wx*/configarg.cache
$(WXMSWMSVC): $(WXSRC)
$(MAKE) $(EMF) wxsrc
rm -rf $@ $@.org
mkdir -p $@.org
tar -xjf $(WXSRC) -C $@.org
mv -f $@.org/wx* $@
rmdir $@.org
/bin/sh tools/wxmsvc.sh $@
touch $@
$(WXMACX86): $(BUILDDIR)
@echo "Compiling wxWidgets for Mac OS X (x86)..."
rm -fr $@
mkdir -p $@
CWD=`pwd`; cd $(BUILDDIR)/wx* && \
./configure --prefix="$$CWD/$@" CC="$(MACX86CC)" CXX="$(MACX86CXX)" \
CFLAGS="$(MACX86CFLAGS) $(CFLAGS)" \
CXXFLAGS="$(MACX86CFLAGS) $(CXXFLAGS)" \
CPPFLAGS="$(MACX86CPPFLAGS)" \
LDFLAGS="$(MACX86LDFLAGS)" \
$(WXCFG_FLAGS) $(WXCFG_MAC)
$(MAKE) -C $(BUILDDIR)/wx* all
$(MAKE) -C $(BUILDDIR)/wx* install
$(MAKE) -C $(BUILDDIR)/wx* distclean
rm -f $(BUILDDIR)/wx*/configarg.cache
sed -e "s/-Wl,-syslibroot,[^ ]*//" -i.bak $@/lib/wx/config/*
$(WXMACPPC): $(BUILDDIR)
@echo "Compiling wxWidgets for Mac OS X (PowerPC)..."
rm -fr $@
mkdir -p $@
CWD=`pwd`; cd $(BUILDDIR)/wx* && \
./configure --prefix="$$CWD/$@" CC="$(MACPPCCC)" CXX="$(MACPPCCXX)" \
CFLAGS="$(MACPPCCFLAGS) $(CFLAGS)" \
CXXFLAGS="$(MACPPCCFLAGS) $(CXXFLAGS)" \
CPPFLAGS="$(MACPPCCPPFLAGS)" \
LDFLAGS="$(MACPPCLDFLAGS)" \
$(WXCFG_FLAGS) $(WXCFG_MAC) \
--disable-precomp-headers
$(MAKE) -C $(BUILDDIR)/wx* all
$(MAKE) -C $(BUILDDIR)/wx* install
$(MAKE) -C $(BUILDDIR)/wx* distclean
rm -f $(BUILDDIR)/wx*/configarg.cache
sed -e "s/-Wl,-syslibroot,[^ ]*//" -i.bak $@/lib/wx/config/*
$(WXMAC):
$(MAKE) $(EMF) $(WXMACX86)
$(MAKE) $(EMF) $(WXMACPPC)
touch $@
# End of File