-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
164 lines (137 loc) · 4.37 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
#:This makefile gives convenient shortcuts to build and test code_aster.
#:
#:Targets:
#: default Default task, selected by DEFAULT environment variable: 'safe' by default.
#: bootstrap Run 'configure', 'safe' and 'doc'.
#: all Run 'bootstrap' for 'mpi' and 'debug' configurations.
#:
#: configure Configure the project: 'waf configure'
#: install Alias for 'safe'
#: safe Build and install in safe mode: 'waf install --safe'
#: fast Build and install in fast mode: 'waf install --fast'
#: The difference between safe and fast modes is the algorithm used
#: to check changes of dependencies.
#: doc Build the embedded Html documentation: 'waf doc'
#: distclean Perform a distclean of the build directory: 'waf distclean'
#: install-tests Same as 'fast' by adding the '--install-tests' option
#: test Execute a testcase, use 'n' variable: 'waf test -n xxx'
#:
#:The same targets exist with '_debug' suffix (configure_debug, install_debug, test_debug...)
#:which use 'waf_debug' instead of 'waf'.
#:
#: help Show this help message
#:
#: <testname> An unknown target is treated as a testname, same 'make test n=testname'
#:
#:Environment variables:
#: BUILD Build variant 'mpi', 'debug' (default: %BUILD%)
#: DEFAULT Default selected target (default: %DEFAULT%)
#: OPTS Options passed to waf commands, example OPTS='-p'
#:
#:With all prerequisites well configured (example in a up-to-date container) you may run:
#: ./configure
#: make
#:or
#: make bootstrap
#:
#:Build both optimized and debug versions:
#: make all
#:
#:To build a sequential version, you must explicitly set BUILD=std (but you
#:can not build std+debug using this makefile).
#:
#:You may add options to the 'waf' commands by using the OPTS environment variable
#:on the command line (example: with a progress bar):
#: make safe OPTS='-p'
#:The number of jobs is directly passed to make (example: sequential build, limit to 4 tasks):
#: export BUILD=std
#: make -j 16
#:
#:Execute a testcase:
#: make test n=ssll112a
#:or:
#: make ssll112a
BUILD ?= mpi
OPTS ?=
# extract '-j' option to be passed to waf
JOBS ?= $(shell \
j="-j"; \
if grep -q -- "-j" <<< "$(MAKEFLAGS)"; then \
j=-j$$( sed -e 's/.*-j\([0-9]\+\).*/\1/' <<< "$(MAKEFLAGS)" ) ; \
fi; \
[ "$$j" = "-j" ] && j="-j$$(nproc)"; \
echo $$j )
DEFAULT ?= safe
SHELL = /bin/bash
.PHONY: help default bootstrap bootstrap_debug all
# targets for BUILD configuration
.PHONY: configure install safe fast doc distclean install-tests test
# same targets for 'debug' configuration
.PHONY: configure_debug install_debug safe_debug fast_debug doc_debug distclean_debug
.PHONY: install-tests_debug test_debug
.PHONY: clean_cache
default: $(DEFAULT)
all:
$(MAKE) BUILD=mpi bootstrap
$(MAKE) BUILD=debug bootstrap
bootstrap: configure safe doc
configure:
./waf_$(BUILD) configure $(OPTS)
install: safe
safe:
./waf_$(BUILD) install $(OPTS) --safe $(JOBS)
fast:
./waf_$(BUILD) install $(OPTS) --fast $(JOBS)
doc:
@( \
if [ $(BUILD) = "std" ]; then \
echo "doc skipped, only available in parallel" ; \
exit 0 ; \
fi ; \
./waf_$(BUILD) doc $(OPTS) ; \
)
distclean: ##- perform a distclean of the build directory.
./waf_$(BUILD) distclean
install-tests:
$(MAKE) fast OPTS="$(OPTS) --install-tests"
n ?=
test:
@( \
if [ -z "$(n)" ]; then \
echo "usage: make test n=testname" ; \
exit 1 ; \
fi ; \
./waf_$(BUILD) test $(OPTS) -n $(n) ; \
)
bootstrap_debug: configure_debug safe_debug doc_debug
configure_debug:
$(MAKE) BUILD=debug configure
install_debug:
$(MAKE) BUILD=debug install
safe_debug:
$(MAKE) BUILD=debug safe
fast_debug:
$(MAKE) BUILD=debug fast
doc_debug:
$(MAKE) BUILD=debug doc
distclean_debug:
$(MAKE) BUILD=debug distclean
clean_cache:
@rm -rf $$(find * -type d -name __pycache__ ! -path 'build/*')
install-tests_debug:
$(MAKE) BUILD=debug install-tests
test_debug:
$(MAKE) BUILD=debug test n=$(n)
help : makefile
@sed -n 's/^#://p' $< | \
sed -e 's/%BUILD%/$(BUILD)/g' -e 's/%DEFAULT%/$(DEFAULT)/g'
%:
@( \
if [ ! -f ../src/astest/"$@".export ] && [ ! -f ../validation/astest/"$@".export ]; then \
echo "not a testcase: $@"; \
exit 1; \
fi; \
)
$(MAKE) --no-print-directory test n="$@"
# parallelism is enabled by waf
.NOTPARALLEL: