forked from NIFTI-Imaging/nifti_clib
/
Makefile
221 lines (162 loc) · 5.07 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
SHELL = csh
## Projects
NIFTI = niftilib
ZNZ = znzlib
FSLIO = fsliolib
EXAMPLES = examples
UTILS = utils
UTILS_PROGS = nifti_stats nifti_tool nifti1_test
THIS_DIR = `basename ${PWD}`
## Note the TARFILE_NAME embeds the release version number
TARFILE_NAME = nifticlib-0.3
## Compiler defines
cc = gcc
CC = gcc
AR = ar
RANLIB = ranlib
DEPENDFLAGS = -MM
GNU_ANSI_FLAGS = -Wall -ansi -pedantic
ANSI_FLAGS = ${GNU_ANSI_FLAGS}
CFLAGS = $(ANSI_FLAGS)
## Command defines
## gmake does not work on MacOSX or some versions of linux MAKE = gmake
RM = rm
MV = mv
CP = cp
TAR = /usr/freeware/bin/tar
## Installation
INSTALL_BIN_DIR = bin
INSTALL_LIB_DIR = lib
INSTALL_INC_DIR = include
## Zlib defines
ZLIB_INC = -I/usr/include
ZLIB_PATH = -L/usr/lib
ZLIB_LIBS = $(ZLIB_PATH) -lm -lz
## Platform specific redefines
## SGI 32bit
ZLIB_INC = -I/usr/freeware/include
ZLIB_PATH = -L/usr/freeware/lib32
RANLIB = echo "ranlib not needed"
## RedHat Fedora Linux
## ZLIB_INC = -I/usr/include
## ZLIB_PATH = -L/usr/lib
#################################################################
## ZNZ defines
ZNZ_INC = -I../$(ZNZ)
ZNZ_PATH = -L../$(ZNZ)
ZNZ_LIBS = $(ZNZ_PATH) -lznz
USEZLIB = -DHAVE_ZLIB
## NIFTI defines
NIFTI_INC = -I../$(NIFTI)
NIFTI_PATH = -L../$(NIFTI)
NIFTI_LIBS = $(NIFTI_PATH) -lniftiio
## FSLIO defines
FSLIO_INC = -I../$(FSLIO)
FSLIO_PATH = -L../$(FSLIO)
FSLIO_LIBS = $(FSLIO_PATH) -lfslio
## Rules
.SUFFIXES: .c .o
.c.o:
$(CC) -c $(CFLAGS) $(INCFLAGS) $<
## Targets
all: znz nifti fslio install
install: znz_install nifti_install fslio_install utils_install
clean: znz_clean nifti_clean fslio_clean examples_clean utils_clean
clean_all: clean install_clean doc_clean
znz:
echo "arch is $(ARCH)"
(cd $(ZNZ); $(MAKE) depend; $(MAKE) lib;)
@echo " ----------- $(ZNZ) build completed."
@echo ""
nifti: znz
(cd $(NIFTI); $(MAKE) depend; $(MAKE) lib;)
@echo " ----------- $(NIFTI) build completed."
@echo ""
fslio: nifti
(cd $(FSLIO); $(MAKE) depend; $(MAKE) lib;)
@echo " ---------- $(FSLIO) build completed."
@echo ""
example:nifti
(cd $(EXAMPLES); $(MAKE) all;)
@echo Example programs built.
@echo ""
utils: nifti
(cd $(UTILS); $(MAKE) all;)
@echo Utility programs built.
@echo ""
doc:
(cd docs; doxygen Doxy_nifti.txt;)
@echo "doxygen doc rebuilt, run netscape docs/html/index.html to view."
@echo ""
$(INSTALL_BIN_DIR):
mkdir -p $@
$(INSTALL_INC_DIR):
mkdir -p $@
$(INSTALL_LIB_DIR):
mkdir -p $@
znz_install: $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
($(CP) $(ZNZ)/*.a $(INSTALL_LIB_DIR); $(CP) $(ZNZ)/*.h $(INSTALL_INC_DIR);)
$(RANLIB) $(INSTALL_LIB_DIR)/*.a
@echo " $(ZNZ) installed."
@echo ""
nifti_install: $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
($(CP) $(NIFTI)/*.a $(INSTALL_LIB_DIR); $(CP) $(NIFTI)/*.h $(INSTALL_INC_DIR);)
$(RANLIB) $(INSTALL_LIB_DIR)/*.a
@echo " $(NIFTI) installed."
@echo ""
fslio_install: $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
($(CP) $(FSLIO)/*.a $(INSTALL_LIB_DIR); $(CP) $(FSLIO)/*.h $(INSTALL_INC_DIR);)
$(RANLIB) $(INSTALL_LIB_DIR)/*.a
@echo " $(FSLIO) installed."
@echo ""
utils_install: utils $(INSTALL_BIN_DIR)
(cd $(UTILS); $(CP) $(UTILS_PROGS) ../$(INSTALL_BIN_DIR);)
@echo " $(UTILS) installed."
@echo ""
install_clean:
($(RM) -f $(INSTALL_INC_DIR)/* $(INSTALL_LIB_DIR)/* $(INSTALL_BIN_DIR)/*;)
znz_clean:
(cd $(ZNZ); $(RM) -f *.o *.a core; $(RM) -f depend.mk;)
nifti_clean:
(cd $(NIFTI); $(RM) -f *.o *.a core; $(RM) -f depend.mk;)
fslio_clean:
(cd $(FSLIO); $(RM) -f *.o *.a core; $(RM) -f depend.mk;)
examples_clean:
(cd $(EXAMPLES); $(MAKE) clean;)
utils_clean:
(cd $(UTILS); $(MAKE) clean;)
doc_clean:
($(RM) -fr docs/html;)
tar:
(cd .. ; ln -s $(THIS_DIR) ${TARFILE_NAME} ; \
$(TAR) --exclude=CVS -cf ${TARFILE_NAME}.tar ${TARFILE_NAME}/*; \
rm -f ${TARFILE_NAME});
@echo ''
@echo 'tar file ../${TARFILE_NAME}.tar has been created.'
@echo ''
help:
@echo ""
@echo "all: build and install znz, nifti1 and fslio"
@echo " libraries, and the utils programs"
@echo "install: install znz, nifti1, and fslio libraries"
@echo "doc: build the doxygen docs for this project."
@echo " (Need doxygen installed, see"
@echo " http://www.stack.nl/~dimitri/doxygen/index.html"
@echo "tar: make a tar file of all nifti_io code, put in .."
@echo ""
@echo "clean: remove .o .a etc. files from source directories,"
@echo " and remove examples and utils programs"
@echo "clean_all: make clean and delete all installed files in bin,"
@echo " include and lib, and remove any autogenerated"
@echo " docs (docs/html)"
@echo ""
@echo "znz: build the znz library"
@echo "znz_install: install the znz library"
@echo "nifti: build the nifti1 library"
@echo "nifti_install: install the nifti1 library"
@echo "fslio: build the fslio library"
@echo "fslio_install: install the fslio library"
@echo "example: make the example program(s)"
@echo "utils: make the utils programs"
@echo "utils_install: install the utils programs"
@echo ""