-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathMakefile
346 lines (259 loc) · 11 KB
/
Makefile
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#!/usr/bin/env make -f
# General Makefile to compile SPM C-MEX files
#
# Copyright (C) 1991-2013 Wellcome Trust Centre for Neuroimaging
#
# $Id: Makefile 5720 2013-10-31 13:46:05Z guillaume $
#
###############################################################################
#
# This Makefile has been tested under Linux, Windows and MacOS.
#
# If you have to tweak this Makefile or Makefile.var to compile the SPM
# mex-files for your platform, please send the details to <fil.spm@ucl.ac.uk>
# so they can be included here.
#
# To compile and install SPM, type the following in a Unix console:
# > make distclean && make && make install
#
# You can specify a particular platform with the following syntax:
# > make PLATFORM=Your_Platform
# The standard targets are 'all', 'clean', 'distclean' and 'install'.
#
# For a list of compatible compilers, see
# http://www.mathworks.com/support/compilers/current_release/
#
###############################################################################
include Makefile.var
###############################################################################
# Objects to go in the archive and mexfiles
###############################################################################
OBS =\
utils_uchar.$(SUF).o utils_short.$(SUF).o utils_int.$(SUF).o \
utils_schar.$(SUF).o utils_ushort.$(SUF).o utils_uint.$(SUF).o\
utils_float.$(SUF).o utils_double.$(SUF).o\
utils_short_s.$(SUF).o utils_int_s.$(SUF).o\
utils_ushort_s.$(SUF).o utils_uint_s.$(SUF).o\
utils_float_s.$(SUF).o utils_double_s.$(SUF).o\
spm_make_lookup.$(SUF).o spm_getdata.$(SUF).o spm_vol_access.$(SUF).o\
spm_mapping.$(SUF).o
SPMMEX =\
spm_sample_vol.$(SUF) spm_slice_vol.$(SUF) spm_brainwarp.$(SUF)\
spm_add.$(SUF) spm_conv_vol.$(SUF) spm_render_vol.$(SUF)\
spm_global.$(SUF) spm_resels_vol.$(SUF)\
spm_bsplinc.$(SUF) spm_bsplins.$(SUF)\
spm_unlink.$(SUF) spm_existfile.$(SUF) spm_gamrnd.$(SUF)\
spm_hist.$(SUF) spm_krutil.$(SUF) spm_project.$(SUF) spm_hist2.$(SUF)\
spm_dilate_erode.$(SUF) spm_bwlabel.$(SUF) spm_get_lm.$(SUF)\
spm_voronoi.$(SUF) spm_mesh_utils.$(SUF) \
spm_mrf.$(SUF) spm_diffeo.$(SUF) spm_field.$(SUF) \
spm_vec.$(SUF) spm_unvec.$(SUF) spm_cat.$(SUF)
SUBDIRS =\
@file_array/private \
@xmltree/private \
toolbox/FieldMap
###############################################################################
# Public make targets
###############################################################################
all: verb.$(SUF) main-all tbx-all verb.all.end
clean: verb.clean main-clean tbx-clean
distclean: clean verb.distclean main-distclean tbx-distclean verb.distclean.end
install: verb.install main-all main-install tbx-install verb.install.end
external external-all external-clean external-distclean external-install external-tarball: verb.external
@ $(MAKE) -C ../external --no-print-directory $(subst -,,$(subst external,,$@))
tarball: all tbx-tarball verb.tarball
$(TAR) cf spm_mex.tar $(SPMMEX)
@@for p in $(SUBDIRS); do \
$(TAR) Af spm_mex.tar ../$$p/spm_mex.tar;\
done
$(ZIP) spm_mex.tar
###############################################################################
# Private make targets
###############################################################################
main-all: $(SPMMEX)
main-clean:
$(DEL) $(OBS)
ifeq (mex,$(SUF))
$(DEL) $(subst .$(SUF),.o,$(SPMMEX)) spm_matfuns.o bsplines.o
endif
main-distclean:
$(DEL) $(SPMMEX) spm_vol_utils.$(SUF).a
main-install:
$(COPY) $(SPMMEX) ..
$(MOVE) ../spm_brainwarp.$(SUF) ../toolbox/OldNorm
archive: spm_vol_utils.$(SUF).a
tbx tbx-all tbx-clean tbx-distclean tbx-install tbx-tarball:
@@for p in $(SUBDIRS); do \
$(MAKE) -C ../$$p $(subst -,,$(subst tbx,,$@));\
done
.PHONY: toolbox toolbox-all toolbox-clean toolbox-distclean toolbox-install toolbox-tarball
toolbox toolbox-all toolbox-clean toolbox-distclean toolbox-install toolbox-tarball:
$(warning Target "toolbox" is deprecated.)
###############################################################################
# Compile spm_vol_utils.c with various flags
###############################################################################
spm_vol_utils.$(SUF).a: $(OBS)
$(DEL) $@
ifeq (windows,$(PLATFORM))
$(AR)$@ $(OBS)
else
$(AR) $@ $(OBS)
endif
UTILS = spm_vol_utils.c spm_make_lookup.h spm_getdata.h
utils_uchar.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_short.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_SIGNED_SHORT $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_int.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_SIGNED_INT $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_schar.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_SIGNED_CHAR $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_ushort.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_UNSIGNED_SHORT $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_uint.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_UNSIGNED_INT $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_float.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_FLOAT $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_double.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_DOUBLE $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_short_s.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_SIGNED_SHORT -DSPM_BYTESWAP $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_int_s.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_SIGNED_INT -DSPM_BYTESWAP $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_ushort_s.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_UNSIGNED_SHORT -DSPM_BYTESWAP $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_uint_s.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_UNSIGNED_INT -DSPM_BYTESWAP $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_float_s.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_FLOAT -DSPM_BYTESWAP $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
utils_double_s.$(SUF).o: $(UTILS)
$(MEX) -c spm_vol_utils.c -DSPM_DOUBLE -DSPM_BYTESWAP $(MEXEND)
$(MOVE) spm_vol_utils.$(MOSUF) $@
###############################################################################
# Compile a few additional C routines for linking
###############################################################################
%.$(SUF).o : %.c
$(MEX) -c $< $(MEXEND)
$(MOVE) %.$(MOSUF) $@
spm_getdata.$(SUF).o: spm_getdata.c spm_getdata.h
$(MEX) -c spm_getdata.c $(MEXEND)
$(MOVE) spm_getdata.$(MOSUF) $@
spm_vol_access.$(SUF).o: spm_vol_access.c spm_vol_access.h spm_datatypes.h
$(MEX) -c spm_vol_access.c $(MEXEND)
$(MOVE) spm_vol_access.$(MOSUF) $@
spm_make_lookup.$(SUF).o: spm_make_lookup.c spm_make_lookup.h
$(MEX) -c spm_make_lookup.c $(MEXEND)
$(MOVE) spm_make_lookup.$(MOSUF) $@
spm_mapping.$(SUF).o: spm_mapping.c spm_mapping.h spm_vol_access.h spm_datatypes.h
$(MEX) -c spm_mapping.c $(MEXEND)
$(MOVE) spm_mapping.$(MOSUF) $@
###############################################################################
# Compile the mex files themselves
###############################################################################
%.$(SUF) : %.c
$(MEX) $< $(MEXEND)
spm_add.$(SUF): spm_add.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_add.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_brainwarp.$(SUF): spm_brainwarp.c spm_matfuns.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_brainwarp.c spm_vol_utils.$(SUF).a spm_matfuns.c $(MEXEND)
spm_bsplinc.$(SUF): spm_bsplinc.c bsplines.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h bsplines.h
$(MEX) spm_bsplinc.c bsplines.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_conv_vol.$(SUF): spm_conv_vol.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h spm_datatypes.h
$(MEX) spm_conv_vol.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_global.$(SUF): spm_global.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_global.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_render_vol.$(SUF): spm_render_vol.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_render_vol.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_resels_vol.$(SUF): spm_resels_vol.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_resels_vol.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_sample_vol.$(SUF): spm_sample_vol.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_sample_vol.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_slice_vol.$(SUF): spm_slice_vol.c spm_vol_utils.$(SUF).a\
spm_mapping.h spm_vol_access.h
$(MEX) spm_slice_vol.c spm_vol_utils.$(SUF).a $(MEXEND)
spm_bsplins.$(SUF): spm_bsplins.c bsplines.c bsplines.h
$(MEX) spm_bsplins.c bsplines.c $(MEXEND)
spm_bwlabel.$(SUF): spm_bwlabel.c
$(MEX) spm_bwlabel.c $(MEXEND)
spm_dilate_erode.$(SUF): spm_dilate_erode.c
$(MEX) spm_dilate_erode.c $(MEXEND)
spm_existfile.$(SUF): spm_existfile.c
$(MEX) spm_existfile.c $(MEXEND)
spm_gamrnd.$(SUF): spm_gamrnd.c
$(MEX) spm_gamrnd.c $(MEXEND)
spm_get_lm.$(SUF): spm_get_lm.c
$(MEX) spm_get_lm.c $(MEXEND)
spm_hist.$(SUF): spm_hist.c
$(MEX) spm_hist.c $(MEXEND)
spm_hist2.$(SUF): spm_hist2.c
$(MEX) spm_hist2.c $(MEXEND)
spm_krutil.$(SUF): spm_krutil.c
$(MEX) spm_krutil.c $(MEXEND)
spm_project.$(SUF): spm_project.c
$(MEX) spm_project.c $(MEXEND)
spm_unlink.$(SUF): spm_unlink.c
$(MEX) spm_unlink.c $(MEXEND)
spm_voronoi.$(SUF): spm_voronoi.c
$(MEX) spm_voronoi.c $(MEXEND)
spm_mrf.$(SUF): spm_mrf.c
$(MEX) spm_mrf.c $(MEXEND)
spm_diffeo.$(SUF): spm_diffeo.c shoot_diffeo3d.c shoot_optim3d.c shoot_multiscale.c shoot_regularisers.c shoot_expm3.c shoot_invdef.c shoot_dartel.c shoot_boundary.c shoot_bsplines.c bsplines.c
$(MEX) spm_diffeo.c shoot_diffeo3d.c shoot_optim3d.c shoot_multiscale.c shoot_regularisers.c shoot_expm3.c shoot_invdef.c shoot_dartel.c shoot_boundary.c shoot_bsplines.c bsplines.c -DIMAGE_SINGLE $(MEXEND)
spm_field.$(SUF): spm_field.c shoot_optimN.c shoot_multiscale.c shoot_boundary.c
$(MEX) spm_field.c shoot_optimN.c shoot_multiscale.c shoot_boundary.c $(MEXEND)
###############################################################################
# Display Messages
###############################################################################
verb.clean:
$(call verb, "Deleting object (.o) files")
verb.distclean:
$(call verb, "Deleting MEX (.$(SUF)) and archive (.a) files")
verb.install:
$(call verb, "Installing MEX files")
verb.tarball:
$(call verb, "Creating archive spm_mex.tar.gz")
verb.mexw32:
$(call verb, "Windows compilation (32 bit)")
verb.mexw64:
$(call verb, "Windows compilation (64 bit)")
verb.mexglx:
$(call verb, "Linux compilation (x86-32)")
verb.mexa64:
$(call verb, "Linux compilation (x86-64)")
verb.mexmac:
$(call verb, "MacOS compilation (PowerPC)")
verb.mexmaci:
$(call verb, "MacOS compilation (Intel 32 bit)")
verb.mexmaci64:
$(call verb, "MacOS compilation (Intel 64 bit)")
verb.mex:
$(call verb, "${PLATFORM} compilation (`octave -v | head -n 1`)")
verb.all.end:
$(call verb, "Compilation: done")
verb.distclean.end:
$(call verb, "Distclean: done")
verb.install.end:
$(call verb, "Installation: done")
verb.external:
$(call verb, "In external")