/
Makefile
165 lines (114 loc) · 4.22 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
MCDS_DIR = lib/MultiCellDS/v1.0/v1.0.0
XSDE_DIR = $(MCDS_DIR)/libMCDS/xsde
LIBCS_DIR = lib/libCellShape
CATCH2_DIR = lib/Catch2
HOOMD_DIR = lib/hoomd
MUSCLE3_DIR = lib/muscle3
TST_DIR = src
QMAKE = qmake
# Edit the above line as necessary, e.g., as follows:
#QMAKE = /Applications/Qt5/6.4.0/macos/bin/qmake
MODELS = bin/vessel bin/qPotts bin/sorting bin/Act_model
.PHONY: all XSDE MCDS LIBCS Catch2 TST python mpi4py ecm docs
.PHONY: test clean clean_hoomd
# Derive Python install location
PYTHON_VERSION = $(shell python -c 'import sys; print("python{}.{}".format(*sys.version_info[0:2]))')
VENV_PKG = venv/lib/$(PYTHON_VERSION)/site-packages
# The models can not be compiled in parallel, because the qmake run for one
# model would overwrite the files generated by the qmake run for another
# model. So we tell make to build them one by one here.
.NOTPARALLEL: all
all: $(MODELS)
.NOTPARALLEL: with_adhesions
with_adhesions: $(MODELS) bin/adhesions ecm ymmsl/adhesions.ymmsl ymmsl/plot_state.ymmsl ymmsl/dump_state.ymmsl
# Dependencies
XSDE:
$(MAKE) -C $(XSDE_DIR)
MCDS: XSDE
$(MAKE) -C $(MCDS_DIR) objects
LIBCS: MCDS
$(MAKE) -C $(LIBCS_DIR)
Catch2:
$(MAKE) -C $(CATCH2_DIR)
MUSCLE3:
$(MAKE) -C $(MUSCLE3_DIR)
# Python virtual environment and components
# Representative targets, we assume that if these are up to date, the corresponding
# object has been created successfully.
VENV = venv/bin/activate
VENV_NUMPY = $(VENV_PKG)/numpy/__init__.py
VENV_HOOMD = $(VENV_PKG)/hoomd/__init__.py
VENV_DOCS = venv_docs/bin/activate
# If MPI should be used, install mpi4py and compile hoomd with MPI enabled
ifdef ENABLE_MPI
$(info Enabling MPI. If you get compilation errors, check that you have)
$(info an MPI library like OpenMPI or MPICH installed, and that it)
$(info includes development tools and headers if applicable.)
$(info )
export HOOMD_BUILD_OPTIONS += -DENABLE_MPI=ON
python: mpi4py
endif # ENABLE_MPI
$(VENV):
python3 -m venv venv
$(VENV_NUMPY): $(VENV)
. venv/bin/activate && python3 -m pip install numpy
$(VENV_HOOMD): $(VENV) $(VENV_NUMPY)
. venv/bin/activate && $(MAKE) -C $(HOOMD_DIR) install
@# The hoomd installer doesn't touch the file, so we do it here so we don't keep
@# reinstalling again and again.
touch $(VENV_HOOMD)
$(VENV_DOCS):
python3 -m venv venv_docs
. venv_docs/bin/activate && python -m pip install -r ./doc/requirements.txt
docs: $(VENV_DOCS)
cd doc; doxygen Doxyfile.in
. venv_docs/bin/activate && $(MAKE) -C doc html
rm -r doc/docs/* || true
mv doc/build/html doc/docs
mpi4py: $(VENV)
. venv/bin/activate && python3 -m pip install mpi4py
python: $(VENV)
. venv/bin/activate && python3 -m pip install -e .
ecm: $(VENV_HOOMD) python
# Models
bin/%: MCDS LIBCS
cd $(TST_DIR) && $(QMAKE) $(@:bin/%=%).pro
$(MAKE) -C $(TST_DIR)
bin/adhesions: MUSCLE3
ymmsl:
mkdir ymmsl
ymmsl/%.ymmsl: src/models/%.ymmsl.in ymmsl
sed -e 's&Tissue-Simulation-Toolkit&$(CURDIR)&g' $< >$@
# Tests
CATCH2_BASE = $(CATCH2_DIR)/catch2
export CATCH2_BASE
test: Catch2 MCDS LIBCS
tox
# Add new directories with C++ tests here and also below under clean:
$(MAKE) -C $(TST_DIR)/adhesions/tests run_all_tests
$(MAKE) -C $(TST_DIR)/cellular_potts/tests run_all_tests
$(MAKE) -C $(TST_DIR)/spatial/tests run_all_tests
$(MAKE) -C $(TST_DIR)/parameters/tests run_all_tests
# Cleanup
clean:
$(MAKE) -C $(XSDE_DIR) clean
# MCDS make clean is broken, so do it by hand here
rm -f $(MCDS_DIR)/libMCDS/mcds_api/*.o $(MCDS_DIR)/libMCDS/mcds_api/*.a
$(MAKE) -C $(LIBCS_DIR) clean
$(MAKE) -C $(CATCH2_DIR) clean
$(MAKE) -C $(MUSCLE3_DIR) clean
# This fails if it hasn't been built and there's no Makefile, that's fine
-$(MAKE) -C $(TST_DIR) clean
rm -rf bin build_files/* $(TST_DIR)/Makefile $(TST_DIR)/.qmake.stash venv
rm -rf build
# Add new test directories here
$(MAKE) -C $(TST_DIR)/adhesions/tests clean
$(MAKE) -C $(TST_DIR)/cellular_potts/tests clean
$(MAKE) -C $(TST_DIR)/spatial/tests clean
$(MAKE) -C $(TST_DIR)/parameters/tests clean
@echo
@echo "Note: 'make clean' does not remove hoomd, because hoomd takes a long time to"
@echo "recompile and you probably don't want to do that. If you do want to rebuild"
@echo "hoomd, use 'make clean_hoomd' to clean it up."
clean_hoomd:
$(MAKE) -C $(HOOMD_DIR) clean