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