1 | ######################## -*- Mode: Makefile-Automake -*- ######################
|
---|
2 | ##
|
---|
3 | ## Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
4 | ##
|
---|
5 | ## The contents of this file are covered under the licence agreement in the
|
---|
6 | ## file "LICENCE" distributed with Cforall.
|
---|
7 | ##
|
---|
8 | ## Makefile.am --
|
---|
9 | ##
|
---|
10 | ## Author : Peter A. Buhr
|
---|
11 | ## Created On : Sun May 31 09:08:15 2015
|
---|
12 | ## Last Modified By : Peter A. Buhr
|
---|
13 | ## Last Modified On : Thu Dec 19 22:11:14 2024
|
---|
14 | ## Update Count : 200
|
---|
15 | ###############################################################################
|
---|
16 |
|
---|
17 | AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names
|
---|
18 | ACLOCAL_AMFLAGS = -I automake
|
---|
19 |
|
---|
20 | include $(top_srcdir)/tools/build/cfa.make
|
---|
21 |
|
---|
22 | DEFAULT_INCLUDES = -I${abs_srcdir}
|
---|
23 |
|
---|
24 | debug ?= yes
|
---|
25 | installed ?= no
|
---|
26 | ARCH = ${if ${arch},"--arch=${arch}"}
|
---|
27 | arch_support = "x86/x64/arm"
|
---|
28 | TIMEOUT = ${if ${timeout},"--timeout=${timeout}"}
|
---|
29 | GLOBAL_TIMEOUT = ${if ${global-timeout},"--global-timeout=${global-timeout}"}
|
---|
30 | ARCHIVE_ERRORS = ${if ${archive-errors},"--archive-errors=${archive-errors}"}
|
---|
31 |
|
---|
32 | DEBUG_FLAGS = -debug -g -O0
|
---|
33 |
|
---|
34 | quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
|
---|
35 |
|
---|
36 | TEST_PY = python3 ${builddir}/test.py
|
---|
37 |
|
---|
38 | WFLAGS_STRICT = \
|
---|
39 | -Wall \
|
---|
40 | -Wextra \
|
---|
41 | -Werror
|
---|
42 |
|
---|
43 | WFLAGS_LAX = \
|
---|
44 | -Wall \
|
---|
45 | -Werror=return-type \
|
---|
46 | -Wno-unused-function \
|
---|
47 | -Wno-psabi
|
---|
48 |
|
---|
49 | # These tests opt for lax wflags. (By default, new tests get strict wflags.)
|
---|
50 | # Indented list entries are finer-grained targets under the test.
|
---|
51 | # Making this association implicit would be ideal, but requires learning more automake than is affordable.
|
---|
52 | WFLGAS_OPT_LAX = \
|
---|
53 | ${WFLGAS_OPT_LAX_EXPECT_WARN} \
|
---|
54 | ${WFLGAS_OPT_LAX_TO_INVESTIGATE}
|
---|
55 |
|
---|
56 | # Tests checking that cfa-cc raises a certain warning, so -Werror is permanently inappropriate
|
---|
57 | WFLGAS_OPT_LAX_EXPECT_WARN = \
|
---|
58 | attr-priority \
|
---|
59 | warnings/self-assignment
|
---|
60 |
|
---|
61 | # Tests that need investigation from the CFA team about why they require lax wflags. Goal is to eliminate this list.
|
---|
62 | WFLGAS_OPT_LAX_TO_INVESTIGATE = \
|
---|
63 | attributes \
|
---|
64 | collections/queue \
|
---|
65 | collections/sequence \
|
---|
66 | collections/stack \
|
---|
67 | collections/vector-demo \
|
---|
68 | concurrency/actors/dynamic \
|
---|
69 | concurrency/actors/executor \
|
---|
70 | concurrency/actors/inherit \
|
---|
71 | concurrency/actors/inline \
|
---|
72 | concurrency/actors/matrixMultiply \
|
---|
73 | concurrency/actors/pingpong \
|
---|
74 | concurrency/actors/poison \
|
---|
75 | concurrency/actors/static \
|
---|
76 | concurrency/actors/types \
|
---|
77 | concurrency/channels/churn \
|
---|
78 | concurrency/channels/contend \
|
---|
79 | concurrency/channels/daisy_chain \
|
---|
80 | concurrency/channels/hot_potato \
|
---|
81 | concurrency/channels/pub_sub \
|
---|
82 | concurrency/futures/multi \
|
---|
83 | concurrency/futures/select_future \
|
---|
84 | concurrency/futures/typed \
|
---|
85 | concurrency/lockfree_stack \
|
---|
86 | concurrency/pthread/bounded_buffer \
|
---|
87 | concurrency/pthread/pthread_attr_test \
|
---|
88 | concurrency/pthread/pthread_demo_create_join \
|
---|
89 | concurrency/pthread/pthread_demo_lock \
|
---|
90 | concurrency/pthread/pthread_key_test \
|
---|
91 | concurrency/waituntil/all_types \
|
---|
92 | concurrency/waituntil/basic_else \
|
---|
93 | concurrency/waituntil/channel_close \
|
---|
94 | concurrency/waituntil/channels \
|
---|
95 | concurrency/waituntil/futures \
|
---|
96 | concurrency/waituntil/locks \
|
---|
97 | concurrency/waituntil/repeat_close \
|
---|
98 | concurrency/waituntil/timeout \
|
---|
99 | configs/usage \
|
---|
100 | ctrl-flow/labelledExit \
|
---|
101 | ctrl-flow/loop_else \
|
---|
102 | designations \
|
---|
103 | exceptions/cardgame \
|
---|
104 | exceptions/defaults \
|
---|
105 | exceptions/defaults-threads \
|
---|
106 | exceptions/try-leave-catch \
|
---|
107 | forall \
|
---|
108 | function-operator \
|
---|
109 | gmp \
|
---|
110 | identParamDeclarator \
|
---|
111 | include/includes \
|
---|
112 | include/stdincludes \
|
---|
113 | include/vector-collections \
|
---|
114 | include/vector-fstream \
|
---|
115 | include/vector-sequence \
|
---|
116 | io/away_fair \
|
---|
117 | io/comp_basic \
|
---|
118 | io/comp_fair \
|
---|
119 | io/manipulatorsInput \
|
---|
120 | io/manipulatorsInput-uchunk \
|
---|
121 | io/many_read \
|
---|
122 | math \
|
---|
123 | minmax \
|
---|
124 | operators \
|
---|
125 | poly-many-arsz \
|
---|
126 | polymorphism \
|
---|
127 | raii/ctor-autogen \
|
---|
128 | raii/dtor-early-exit \
|
---|
129 | raii/init_once \
|
---|
130 | references \
|
---|
131 | shortCircuit \
|
---|
132 | sum \
|
---|
133 | switch \
|
---|
134 | tuple/tupleCast \
|
---|
135 | tuple/tupleMember \
|
---|
136 | userLiterals \
|
---|
137 | vector
|
---|
138 |
|
---|
139 | WFLAGS=${if ${filter ${WFLGAS_OPT_LAX},${@}},${WFLAGS_LAX},${WFLAGS_STRICT}}
|
---|
140 |
|
---|
141 | # applies to both programs
|
---|
142 | # since automake doesn't have support for CFA we have to
|
---|
143 | AM_CFLAGS = ${if ${test}, 2> ${test}, } \
|
---|
144 | -fdebug-prefix-map=${abspath ${abs_srcdir}}= \
|
---|
145 | -fdebug-prefix-map=/tmp= \
|
---|
146 | -fno-diagnostics-show-caret \
|
---|
147 | -g \
|
---|
148 | $(WFLAGS) \
|
---|
149 | -quiet @CFA_FLAGS@
|
---|
150 |
|
---|
151 | AM_CFAFLAGS = -XCFA --deterministic-out
|
---|
152 |
|
---|
153 | # get the desired cfa to test
|
---|
154 | TARGET_CFA = ${if ${filter ${installed},yes}, @CFACC_INSTALL@, @CFACC@}
|
---|
155 |
|
---|
156 | # adjust CC to current flags
|
---|
157 | CC = LC_ALL=C ${if ${DISTCC_CFA_PATH},distcc ${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
|
---|
158 | CFACC = ${CC}
|
---|
159 |
|
---|
160 | # get local binary for depedencies
|
---|
161 | CFACCBIN = @CFACC@
|
---|
162 |
|
---|
163 | # adjusted CC but without the actual distcc call
|
---|
164 | CFACCLOCAL = ${if ${DISTCC_CFA_PATH},${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
|
---|
165 | CFACCLINK = ${CFACCLOCAL} -quiet ${if ${test}, 2> ${test}, } ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}}
|
---|
166 |
|
---|
167 | PRETTY_PATH = mkdir -p ${dir ${abspath ${@}}} && cd ${srcdir} &&
|
---|
168 |
|
---|
169 | .PHONY : concurrency list .validate .test_makeflags
|
---|
170 | .INTERMEDIATE : .validate .validate.cfa .test_makeflags
|
---|
171 | EXTRA_PROGRAMS = array-collections/boxed avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install
|
---|
172 | EXTRA_DIST = test.py \
|
---|
173 | pybin/__init__.py \
|
---|
174 | pybin/print-core.gdb \
|
---|
175 | pybin/settings.py \
|
---|
176 | pybin/test_run.py \
|
---|
177 | pybin/tools.py \
|
---|
178 | long_tests.hfa \
|
---|
179 | array-collections/boxed.hfa \
|
---|
180 | array-collections/boxed.cases.hfa \
|
---|
181 | avltree/avl-private.h \
|
---|
182 | avltree/avl.h \
|
---|
183 | exceptions/except-io.hfa \
|
---|
184 | exceptions/with-threads.hfa \
|
---|
185 | meta/fork+exec.hfa \
|
---|
186 | concurrency/clib_tls.c \
|
---|
187 | concurrency/clib.c \
|
---|
188 | concurrency/unified_locking/mutex_test.hfa \
|
---|
189 | concurrency/channels/parallel_harness.hfa \
|
---|
190 | array-collections/dimexpr-match.hfa \
|
---|
191 | array-collections/dimexpr-match-detail.sh \
|
---|
192 | array-collections/array-raii.hfa
|
---|
193 |
|
---|
194 | dist-hook:
|
---|
195 | echo "Gathering test files"
|
---|
196 | for file in `${TEST_PY} --list-dist`; do \
|
---|
197 | if ls ${srcdir}/$${file} > /dev/null 2>&1; then \
|
---|
198 | ${MKDIR_P} $$(dirname ${distdir}/$${file}); \
|
---|
199 | cp -df ${srcdir}/$${file} $$(dirname ${distdir}/$${file}); \
|
---|
200 | fi; \
|
---|
201 | done
|
---|
202 |
|
---|
203 | array_collections_boxed_SOURCES = array-collections/boxed.main.cfa array-collections/boxed.bookend.cfa
|
---|
204 | avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
|
---|
205 | linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
|
---|
206 | linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
|
---|
207 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program
|
---|
208 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
|
---|
209 |
|
---|
210 | #----------------------------------------------------------------------------------------------------------------
|
---|
211 |
|
---|
212 | # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
|
---|
213 | all-local : # This name is important to automake and implies the default build target.
|
---|
214 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} --all
|
---|
215 |
|
---|
216 | tests : all-local # synonym
|
---|
217 |
|
---|
218 | install : all-local # synonym, PAB only
|
---|
219 |
|
---|
220 | quick :
|
---|
221 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${ARCH} ${quick_test}
|
---|
222 |
|
---|
223 | concurrency :
|
---|
224 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} -Iconcurrency
|
---|
225 |
|
---|
226 | list :
|
---|
227 | @+${TEST_PY} --list
|
---|
228 |
|
---|
229 | help :
|
---|
230 | @echo "user targets:"
|
---|
231 | @echo " Run the complete test suite."
|
---|
232 | @echo " $$ make (null) / tests [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [timeout=seconds] [global-timeout=seconds] [arch=${arch_support}]"
|
---|
233 | @echo ""
|
---|
234 | @echo " Run the short (quick) test suite."
|
---|
235 | @echo " $$ make quick [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [arch=${arch_support}]"
|
---|
236 | @echo ""
|
---|
237 | @echo " Run the concurrency test suite."
|
---|
238 | @echo " $$ make concurrency [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [timeout=seconds] [global-timeout=seconds] [arch=${arch_support}]"
|
---|
239 | @echo ""
|
---|
240 | @echo " List all tests in the test suite."
|
---|
241 | @echo " $$ make list"
|
---|
242 |
|
---|
243 | mostlyclean-local :
|
---|
244 | find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
|
---|
245 | find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
|
---|
246 | find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
|
---|
247 | rm -f ${EXTRA_PROGRAMS}
|
---|
248 | rm -rf __pycache__
|
---|
249 |
|
---|
250 | distclean-local :
|
---|
251 | find ${builddir} -path '*.Po' -delete
|
---|
252 |
|
---|
253 | .test_makeflags:
|
---|
254 | @echo "${MAKEFLAGS}"
|
---|
255 |
|
---|
256 | .validate: .validate.cfa
|
---|
257 | ${CFACOMPILE} .validate.cfa -fsyntax-only -Wall -Wextra -Werror
|
---|
258 |
|
---|
259 | .validate.cfa:
|
---|
260 | @echo "int main() { return 0; }" > ${@}
|
---|
261 |
|
---|
262 | # automake doesn't know we still need C rules so pretend like we have a C program
|
---|
263 | .dummy_hack.c:
|
---|
264 | @echo "int main() { return 0; }" > ${@}
|
---|
265 |
|
---|
266 | .dummy_hackxx.cpp:
|
---|
267 | @echo "int bar() { return 0; }" > ${@}
|
---|
268 |
|
---|
269 | #----------------------------------------------------------------------------------------------------------------
|
---|
270 |
|
---|
271 | # Use for all tests, make sure the path are correct and all flags are added
|
---|
272 | CFACOMPILETEST=${PRETTY_PATH} ${CFACOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} ${${shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'}}
|
---|
273 |
|
---|
274 | #----------------------------------------------------------------------------------------------------------------
|
---|
275 |
|
---|
276 | # implicit rule so not all test require a rule
|
---|
277 | # split into two steps to support compiling remotely using distcc
|
---|
278 | # don't use distcc to do the linking because distcc doesn't do linking
|
---|
279 | % : %.cfa ${CFACCBIN}
|
---|
280 | ${CFACOMPILETEST} -c -o ${abspath ${@}}.o -DIN_DIR="${abspath ${dir ${<}}}/.in/"
|
---|
281 | ${CFACCLINK} ${@}.o -o ${abspath ${@}}
|
---|
282 | rm ${abspath ${@}}.o
|
---|
283 |
|
---|
284 | # implicit rule for c++ test
|
---|
285 | # convient for testing the testsuite itself but not actuall used
|
---|
286 | % : %.cpp
|
---|
287 | ${PRETTY_PATH} ${CXXCOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} -o ${abspath ${@}}
|
---|
288 |
|
---|
289 | #------------------------------------------------------------------------------
|
---|
290 | # TARGETS WITH CUSTOM FLAGS
|
---|
291 | #------------------------------------------------------------------------------
|
---|
292 | # custom libs
|
---|
293 | gmp_FLAGSLD= -lgmp
|
---|
294 |
|
---|
295 | #------------------------------------------------------------------------------
|
---|
296 | # Generated code
|
---|
297 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
|
---|
298 | ${GENERATED_CODE} : % : %.cfa ${CFACCBIN}
|
---|
299 | ${CFACOMPILETEST} -CFA -XCFA -p -c -fsyntax-only -o ${abspath ${@}}
|
---|
300 |
|
---|
301 | #------------------------------------------------------------------------------
|
---|
302 | # CUSTOM TARGET
|
---|
303 | #------------------------------------------------------------------------------
|
---|
304 | # tests that just validate syntax and compiler output should be compared to stderr
|
---|
305 | CFACOMPILE_SYNTAX = ${CFACOMPILETEST} -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o ${abspath ${@}}
|
---|
306 |
|
---|
307 | SYNTAX_ONLY_CODE = attr-priority warnings/self-assignment
|
---|
308 |
|
---|
309 | ${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN}
|
---|
310 | ${CFACOMPILE_SYNTAX}
|
---|
311 | ${if ${test}, cp ${test} ${abspath ${@}}, }
|
---|
312 |
|
---|
313 | # expected failures
|
---|
314 | # use custom target since they require a custom define *and* have a name that doesn't match the file
|
---|
315 |
|
---|
316 | array-ERR1 : array.cfa ${CFACCBIN}
|
---|
317 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
318 | -cp ${test} ${abspath ${@}}
|
---|
319 |
|
---|
320 | array-ERR2 : array.cfa ${CFACCBIN}
|
---|
321 | ${CFACOMPILE_SYNTAX} -DERR2
|
---|
322 | -cp ${test} ${abspath ${@}}
|
---|
323 |
|
---|
324 | array-ERR3 : array.cfa ${CFACCBIN}
|
---|
325 | ${CFACOMPILE_SYNTAX} -DERR3
|
---|
326 | -cp ${test} ${abspath ${@}}
|
---|
327 |
|
---|
328 | array-collections/dimexpr-match-c-ERRS : array-collections/dimexpr-match-c.cfa
|
---|
329 | ${CFACOMPILE_SYNTAX} -DERRS
|
---|
330 | -cp ${test} ${abspath ${@}}
|
---|
331 |
|
---|
332 | array-collections/dimexpr-match-cfa-ERRS : array-collections/dimexpr-match-cfa.cfa
|
---|
333 | ${CFACOMPILE_SYNTAX} -DERRS
|
---|
334 | -cp ${test} ${abspath ${@}}
|
---|
335 |
|
---|
336 | alloc-ERROR : alloc.cfa ${CFACCBIN}
|
---|
337 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
338 | -cp ${test} ${abspath ${@}}
|
---|
339 |
|
---|
340 | init1-ERROR : init1.cfa ${CFACCBIN}
|
---|
341 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
342 | -cp ${test} ${abspath ${@}}
|
---|
343 |
|
---|
344 | typedefRedef-ERR1 : typedefRedef.cfa ${CFACCBIN}
|
---|
345 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
346 | -cp ${test} ${abspath ${@}}
|
---|
347 |
|
---|
348 | nested-types-ERR1 : nested-types.cfa ${CFACCBIN}
|
---|
349 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
350 | -cp ${test} ${abspath ${@}}
|
---|
351 |
|
---|
352 | nested-types-ERR2 : nested-types.cfa ${CFACCBIN}
|
---|
353 | ${CFACOMPILE_SYNTAX} -DERR2
|
---|
354 | -cp ${test} ${abspath ${@}}
|
---|
355 |
|
---|
356 | raii/memberCtors-ERR1 : raii/memberCtors.cfa ${CFACCBIN}
|
---|
357 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
358 | -cp ${test} ${abspath ${@}}
|
---|
359 |
|
---|
360 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa ${CFACCBIN}
|
---|
361 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
362 | -cp ${test} ${abspath ${@}}
|
---|
363 |
|
---|
364 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa ${CFACCBIN}
|
---|
365 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
366 | -cp ${test} ${abspath ${@}}
|
---|
367 |
|
---|
368 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa ${CFACCBIN}
|
---|
369 | ${CFACOMPILE_SYNTAX} -DERR2
|
---|
370 | -cp ${test} ${abspath ${@}}
|
---|
371 |
|
---|
372 | raii/partial-ERR1 : raii/partial.cfa ${CFACCBIN}
|
---|
373 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
374 | -cp ${test} ${abspath ${@}}
|
---|
375 |
|
---|
376 | # Exception Tests
|
---|
377 | # Test with libcfathread; it changes how storage works.
|
---|
378 |
|
---|
379 | exceptions/%-threads : exceptions/%.cfa ${CFACCBIN}
|
---|
380 | ${CFACOMPILETEST} -include exceptions/with-threads.hfa -c -o ${abspath ${@}}.o
|
---|
381 | ${CFACCLOCAL} ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} ${abspath ${@}}.o -o ${abspath ${@}}
|
---|
382 |
|
---|
383 | # Linking tests
|
---|
384 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
|
---|
385 | linking/linkerror : linking/linkerror.cfa ${CFACCBIN}
|
---|
386 | ${CFACOMPILETEST} -O0 -c -o ${abspath ${@}}.o
|
---|
387 | ${CFACCLINK} -O0 ${@}.o -o ${abspath ${@}}
|
---|
388 | rm ${abspath ${@}}.o
|
---|
389 |
|
---|
390 | #------------------------------------------------------------------------------
|
---|
391 | # Other targets
|
---|