-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
197 lines (171 loc) · 7.42 KB
/
Copy pathMakefile
File metadata and controls
197 lines (171 loc) · 7.42 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
# Personal Makefile variables
#
# $Id$
.PHONY: clean install zip docs update cp_binaries archive check_pipeline release standalone tests
OLDVERSION="CAT26.0.rc3"
NEWVERSION="CAT26.0.rc4"
REVISION=`git rev-list --count HEAD`
DATE=`git log --date short |grep "Date:"|head -1|cut -f2 -d':'|sed -e s'/ //g'`
VERSION=`echo ${NEWVERSION} | sed -e 's/CAT//g'`
TARGET=/Users/gaser/spm/spm12/toolbox/CAT
TARGET2=/Volumes/UltraMax/spm12/toolbox/CAT
TARGET4=/Users/gaser/spm/spm-octave/toolbox/CAT
PRECOMPILED=/Users/gaser/matlab/Matlab_standalone
# matlab binary and SPM path used by the "tests" target (override on the command line)
MATLAB ?= matlab
SPMDIR ?= /Users/gaser/spm/spm12
STARGET3_HOST=paris.biomag.uni-jena.de
STARGET3_FOLDER=/home/gaser/spm12/toolbox/CAT
STARGET3=${STARGET3_HOST}:${STARGET3_FOLDER}
MATLAB_FILES=Contents.* cat_*.m spm_select.m spm_CAT.m spm_cat12.m tbx_cfg_cat.m sliderPanel.m slice_overlay.m cat_run* compile.m
C_FILES=Amap.[ch] ornlm_float.c sanlm_float.c MrfPrior.c Pve.c Kmeans.c cat_*.c* cat_*.mex* vollib.c genus0.[ch] tricases.h cat_glibc_compat.h spm_diffeo.* tfceMex_pthread.*
MISC_FILES=README.md CHANGES.txt INSTALL.txt doc standalone templates_MNI152NLin2009cAsym templates_surfaces templates_surfaces_32k atlases_surfaces atlases_surfaces_32k cat12.* CAT.* cat_*.sh cat_long_main*txt glass_brain.mat clang*xml
FILES=${MATLAB_FILES} ${C_FILES} ${MISC_FILES}
ZIPFILE=cat${VERSION}.zip
BIN ?= CAT*
# remove .DS_Store files and correct file permissions
clean:
-@find . -type f -name .DS_Store -exec rm {} \;
-@chmod -R a+r,g+w,o-w .
-@find . -type f \( -name "*.sh" -o -name "*.mex*" \) -exec chmod a+x {} \;
-@find . -type f \( -name "*.c" -o -name "*.c??" -o -name "*.m" -o -name "*.gii" -o -name "*.nii" -o -name "*.txt" -o -name "*.html" -o -name "*.annot" \) -exec chmod a-x {} \;
# prepare txt file for deployed versions
copy_longmode:
-@cp -R cat_long_main.m cat_long_main.txt
# install
install: copy_longmode
-@echo install
-@test ! -d ${TARGET} || rm -rf ${TARGET}/*
-@mkdir -p ${TARGET}
-@cp -R ${FILES} ${TARGET}/
-@gzip -df ${TARGET}/*/*.nii.gz
#install on UltraMax
install2: copy_longmode
-@echo install on ${TARGET2}
-@test ! -d ${TARGET2} || rm -rf ${TARGET2}/*
-@mkdir -p ${TARGET2}
-@cp -R ${FILES} ${TARGET2}/
-@gzip -d ${TARGET2}/*/*.nii.gz
#install on paris
install3: copy_longmode
-@echo install on ${STARGET3}
-@bash -c "ssh ${STARGET3_HOST} 'test ! -d ${STARGET3_FOLDER} || rm -rf ${STARGET3_FOLDER}/*'"
-@bash -c "ssh ${STARGET3_HOST} 'test -d ${STARGET3_FOLDER} || mkdir ${STARGET3_FOLDER}'"
-@scp -r ${FILES} ${STARGET3}/
-@bash -c "ssh ${STARGET3_HOST} 'gzip -d ${STARGET3_FOLDER}/*/*.nii.gz'"
# install for octave
install4: copy_longmode
-@echo install
-@test ! -d ${TARGET4} || rm -rf ${TARGET4}/*
-@mkdir -p ${TARGET4}
-@cp -R ${FILES} ${TARGET4}/
-@gzip -d ${TARGET4}/*/*.nii.gz
# print available commands
help:
-@echo Available commands:
-@echo clean install zip docs update cp_binaries archive check_pipeline release standalone tests
-@echo "cp_binaries usage: make cp_binaries [BIN=CAT_MyBinary]"
#make html documentation
docs:
-@cat doc/cat.txt | sed -e 's/VERSION/'${NEWVERSION}'/g' -e 's/RELNUMBER/r'${REVISION}'/g' -e 's/DATE/'${DATE}'/g' > doc/cat.html
-@test ! -d ../cat12-help || cp -R doc/* ../cat12-help/
# update version numbers
update: docs copy_longmode
-@git fetch
-@echo '% Computational Anatomy Toolbox' > Contents.m
-@echo '% Version' ${REVISION}' ('${NEWVERSION}')' ${DATE} >> Contents.m
-@cat Contents_info.txt >> Contents.m
-@cp Contents.m Contents.txt
-@echo '% Computational Anatomy Toolbox' > INSTALL.txt
-@echo '% Version ' ${REVISION} ${NEWVERSION} ${DATE} >> INSTALL.txt
-@cat INSTALL_info.txt >> INSTALL.txt
-@test ! -d ../tfce/ || cp cat_spm_results_ui.m ../tfce/
-@perl -p -i -e "s/${OLDVERSION}/${NEWVERSION}/g" spm_CAT.m
-@perl -p -i -e "s/${OLDVERSION}/${NEWVERSION}/g" cat_batch_bids.sh
-@cp cat12.m CAT.m
-@chmod a+x CAT.*/*
# zip release
zip: update clean
-@echo zip
-@test ! -d CAT || rm -r CAT
-@mkdir CAT
-@cp -rp ${FILES} CAT
-@gzip -df CAT/templates_MNI152NLin2009cAsym/*.nii.gz
-@bash update_revision.sh
-@zip ${ZIPFILE} -rm CAT
# copy binaries after cross-compiling
cp_binaries:
-@echo copy binaries matching $(BIN)
-@for file in ~/GitHub/CAT-Surface/build-*/Progs/*.o; do \
[ -f "$$file" ] && rm "$$file"; \
done
-@for i in CAT.glnx86/$(BIN); do cp ~/GitHub/CAT-Surface/build-x86_64-pc-linux/Progs/`basename $${i}` CAT.glnx86/ ; done
-@for i in CAT.w32/$(BIN); do cp ~/GitHub/CAT-Surface/build-x86_64-w64-mingw32/Progs/`basename $${i}` CAT.w32/ ; done
-@for i in CAT.maci64/$(BIN); do cp ~/GitHub/CAT-Surface/build-native/Progs/`basename $${i}` CAT.maci64/ ; done
-@for i in CAT.maca64/$(BIN); do cp ~/GitHub/CAT-Surface/build-native-arm64/Progs/`basename $${i}` CAT.maca64/ ; done
# print check list for releasing
release: checklist
checklist:
@printf '%s\n' \
'' \
'Checklist for testing CAT12 in order to release' \
'-----------------------------------------------' \
'1. Make unittests' \
' make tests' \
'' \
21. Check Pipeline' \
' make check_pipeline' \
' check_pipeline.sh -p pid' \
' check_all_matrix.sh' \
' check_pipeline_ROIs -> check render views check_r*matrix.png and histograms' \
' check_pipeline_homogeneity -> check sample homogeneity' \
'' \
'3. Check Batches and Dependencies' \
' cd check_pipeline' \
' batch_volume_pipeline' \
' batch_surface_pipeline' \
'' \
'4. Check Expert Mode' \
' cat12('\''expert'\'')' \
' CAT12 GUI Segment' \
'' \
'5. Check Simple Preprocessing' \
' SPM->Tools->CAT12->CAT12 Simple Preprocessing' \
'' \
'6. Create and Check Standalone Versions' \
' https://github.com/ChristianGaser/cat12/actions/workflows/install_test_standalone.yml' \
'' \
'7. Build CAT-Surface binaries and apply make cp_binaries to copy them' \
' https://github.com/ChristianGaser/CAT-Surface/actions/workflows/binaries.yml' \
'' \
'8. Optionally check Skull-Stripping if Pipeline Changed' \
' cat12_all.m in /Volumes/UltraMax/validate_skullstripping_withT12' \
' calc_kappa_c0_SPM12_T12.m' \
'' \
'8. Check thickness phantom' \
'' \
'9. Make fork from new version!'
# print help for standalone
standalone:
@printf '%s\n' \
'' \
'Use CAT action to compile and test standalone versions' \
'https://github.com/ChristianGaser/cat12/actions/workflows/install_test_standalone.yml'
# rescue from archives
archive:
-@echo available archives to install
-@ls cat12_r*zip
-@test ! -d cat12 || rm -rf cat12
-@test ! -d ${TARGET} || rm -rf ${TARGET}
-@read -p "Type release number (3 or 4 digits), followed by [ENTER]:" ver; unzip cat12_r$${ver}.zip; cp -R cat12 ${TARGET}
# run fast unit and compiled-function tests on the working copy
# (no image data required; needs SPM at ${SPMDIR})
tests:
-@echo Running CAT12 unit and mex tests
@${MATLAB} -nodisplay -nosplash -batch "addpath('${SPMDIR}'); cd('${CURDIR}'); ok1 = compile(0,1,2); [ok2,~] = cat_tst_unittests(1); if ~(ok1 && ok2), error('CAT12 tests failed'); end; disp('All CAT12 tests passed.')"
# run check pipeline
check_pipeline: update install
-@echo Check pipeline
-@cd /Volumes/UltraMax/check_pipeline/
-@/Users/gaser/GitHub/cat12/check_pipeline.sh -d /Volumes/UltraMax/check_pipeline/ -s ~/spm/spm12 -bg 8 -f /Volumes/UltraMax/check_pipeline/check_pipeline_files.txt -l /Volumes/UltraMax/check_pipeline/check_pipeline_files_long.txt
-@echo 1. cd /Volumes/UltraMax/check_pipeline/ 2. Call post-processing with the resp. pid: check_pipeline.sh -p pid