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 : Wed Aug 30 22:31:45 2023 |
---|
14 | ## Update Count : 197 |
---|
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 | # applies to both programs |
---|
39 | # since automake doesn't have support for CFA we have to |
---|
40 | AM_CFLAGS = ${if ${test}, 2> ${test}, } \ |
---|
41 | -fdebug-prefix-map=${abspath ${abs_srcdir}}= \ |
---|
42 | -fdebug-prefix-map=/tmp= \ |
---|
43 | -fno-diagnostics-show-caret \ |
---|
44 | -g \ |
---|
45 | -Wall \ |
---|
46 | -Werror=return-type \ |
---|
47 | -Wno-unused-function \ |
---|
48 | -Wno-psabi \ |
---|
49 | -quiet @CFA_FLAGS@ |
---|
50 | |
---|
51 | AM_CFAFLAGS = -XCFA --deterministic-out |
---|
52 | |
---|
53 | # get the desired cfa to test |
---|
54 | TARGET_CFA = ${if ${filter ${installed},yes}, @CFACC_INSTALL@, @CFACC@} |
---|
55 | |
---|
56 | # adjust CC to current flags |
---|
57 | CC = LC_ALL=C ${if ${DISTCC_CFA_PATH},distcc ${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}} |
---|
58 | CFACC = ${CC} |
---|
59 | |
---|
60 | # get local binary for depedencies |
---|
61 | CFACCBIN = @CFACC@ |
---|
62 | |
---|
63 | # adjusted CC but without the actual distcc call |
---|
64 | CFACCLOCAL = ${if ${DISTCC_CFA_PATH},${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}} |
---|
65 | CFACCLINK = ${CFACCLOCAL} -quiet ${if ${test}, 2> ${test}, } ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} |
---|
66 | |
---|
67 | PRETTY_PATH = mkdir -p ${dir ${abspath ${@}}} && cd ${srcdir} && |
---|
68 | |
---|
69 | .PHONY : concurrency list .validate .test_makeflags |
---|
70 | .INTERMEDIATE : .validate .validate.cfa .test_makeflags |
---|
71 | EXTRA_PROGRAMS = array-collections/boxed avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install |
---|
72 | EXTRA_DIST = test.py \ |
---|
73 | pybin/__init__.py \ |
---|
74 | pybin/print-core.gdb \ |
---|
75 | pybin/settings.py \ |
---|
76 | pybin/test_run.py \ |
---|
77 | pybin/tools.py \ |
---|
78 | long_tests.hfa \ |
---|
79 | array-collections/boxed.hfa \ |
---|
80 | array-collections/boxed.cases.hfa \ |
---|
81 | avltree/avl-private.h \ |
---|
82 | avltree/avl.h \ |
---|
83 | exceptions/except-io.hfa \ |
---|
84 | exceptions/with-threads.hfa \ |
---|
85 | meta/fork+exec.hfa \ |
---|
86 | concurrency/clib_tls.c \ |
---|
87 | concurrency/clib.c \ |
---|
88 | concurrency/unified_locking/mutex_test.hfa \ |
---|
89 | concurrency/channels/parallel_harness.hfa \ |
---|
90 | array-collections/dimexpr-match.hfa \ |
---|
91 | array-collections/dimexpr-match-detail.sh \ |
---|
92 | array-collections/array-raii.hfa |
---|
93 | |
---|
94 | dist-hook: |
---|
95 | echo "Gathering test files" |
---|
96 | for file in `${TEST_PY} --list-dist`; do \ |
---|
97 | if ls ${srcdir}/$${file} > /dev/null 2>&1; then \ |
---|
98 | ${MKDIR_P} $$(dirname ${distdir}/$${file}); \ |
---|
99 | cp -df ${srcdir}/$${file} $$(dirname ${distdir}/$${file}); \ |
---|
100 | fi; \ |
---|
101 | done |
---|
102 | |
---|
103 | array_collections_boxed_SOURCES = array-collections/boxed.main.cfa array-collections/boxed.bookend.cfa |
---|
104 | 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 |
---|
105 | linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa |
---|
106 | linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa |
---|
107 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program |
---|
108 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp |
---|
109 | |
---|
110 | #---------------------------------------------------------------------------------------------------------------- |
---|
111 | |
---|
112 | # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program |
---|
113 | all-local : # This name is important to automake and implies the default build target. |
---|
114 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} --all |
---|
115 | |
---|
116 | tests : all-local # synonym |
---|
117 | |
---|
118 | install : all-local # synonym, PAB only |
---|
119 | |
---|
120 | quick : |
---|
121 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${ARCH} ${quick_test} |
---|
122 | |
---|
123 | concurrency : |
---|
124 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} -Iconcurrency |
---|
125 | |
---|
126 | list : |
---|
127 | @+${TEST_PY} --list |
---|
128 | |
---|
129 | help : |
---|
130 | @echo "user targets:" |
---|
131 | @echo " Run the complete test suite." |
---|
132 | @echo " $$ make (null) / tests [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [timeout=seconds] [global-timeout=seconds] [arch=${arch_support}]" |
---|
133 | @echo "" |
---|
134 | @echo " Run the short (quick) test suite." |
---|
135 | @echo " $$ make quick [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [arch=${arch_support}]" |
---|
136 | @echo "" |
---|
137 | @echo " Run the concurrency test suite." |
---|
138 | @echo " $$ make concurrency [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [timeout=seconds] [global-timeout=seconds] [arch=${arch_support}]" |
---|
139 | @echo "" |
---|
140 | @echo " List all tests in the test suite." |
---|
141 | @echo " $$ make list" |
---|
142 | |
---|
143 | mostlyclean-local : |
---|
144 | find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete |
---|
145 | find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete |
---|
146 | find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete |
---|
147 | rm -f ${EXTRA_PROGRAMS} |
---|
148 | rm -rf __pycache__ |
---|
149 | |
---|
150 | distclean-local : |
---|
151 | find ${builddir} -path '*.Po' -delete |
---|
152 | |
---|
153 | .test_makeflags: |
---|
154 | @echo "${MAKEFLAGS}" |
---|
155 | |
---|
156 | .validate: .validate.cfa |
---|
157 | ${CFACOMPILE} .validate.cfa -fsyntax-only -Wall -Wextra -Werror |
---|
158 | |
---|
159 | .validate.cfa: |
---|
160 | @echo "int main() { return 0; }" > ${@} |
---|
161 | |
---|
162 | # automake doesn't know we still need C rules so pretend like we have a C program |
---|
163 | .dummy_hack.c: |
---|
164 | @echo "int main() { return 0; }" > ${@} |
---|
165 | |
---|
166 | .dummy_hackxx.cpp: |
---|
167 | @echo "int bar() { return 0; }" > ${@} |
---|
168 | |
---|
169 | #---------------------------------------------------------------------------------------------------------------- |
---|
170 | |
---|
171 | # Use for all tests, make sure the path are correct and all flags are added |
---|
172 | CFACOMPILETEST=${PRETTY_PATH} ${CFACOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} ${${shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'}} |
---|
173 | |
---|
174 | #---------------------------------------------------------------------------------------------------------------- |
---|
175 | |
---|
176 | # implicit rule so not all test require a rule |
---|
177 | # split into two steps to support compiling remotely using distcc |
---|
178 | # don't use distcc to do the linking because distcc doesn't do linking |
---|
179 | % : %.cfa ${CFACCBIN} |
---|
180 | ${CFACOMPILETEST} -c -o ${abspath ${@}}.o -DIN_DIR="${abspath ${dir ${<}}}/.in/" |
---|
181 | ${CFACCLINK} ${@}.o -o ${abspath ${@}} |
---|
182 | rm ${abspath ${@}}.o |
---|
183 | |
---|
184 | # implicit rule for c++ test |
---|
185 | # convient for testing the testsuite itself but not actuall used |
---|
186 | % : %.cpp |
---|
187 | ${PRETTY_PATH} ${CXXCOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} -o ${abspath ${@}} |
---|
188 | |
---|
189 | #------------------------------------------------------------------------------ |
---|
190 | # TARGETS WITH CUSTOM FLAGS |
---|
191 | #------------------------------------------------------------------------------ |
---|
192 | # custom libs |
---|
193 | gmp_FLAGSLD= -lgmp |
---|
194 | |
---|
195 | #------------------------------------------------------------------------------ |
---|
196 | # Generated code |
---|
197 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions |
---|
198 | ${GENERATED_CODE} : % : %.cfa ${CFACCBIN} |
---|
199 | ${CFACOMPILETEST} -CFA -XCFA -p -c -fsyntax-only -o ${abspath ${@}} |
---|
200 | |
---|
201 | #------------------------------------------------------------------------------ |
---|
202 | # CUSTOM TARGET |
---|
203 | #------------------------------------------------------------------------------ |
---|
204 | # tests that just validate syntax and compiler output should be compared to stderr |
---|
205 | CFACOMPILE_SYNTAX = ${CFACOMPILETEST} -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o ${abspath ${@}} |
---|
206 | |
---|
207 | SYNTAX_ONLY_CODE = \ |
---|
208 | array cast expression identFuncDeclarator init1 limits nested-types numericConstants opt-params quasiKeyword switch typedefRedef variableDeclarator \ |
---|
209 | builtins/sync concurrency/waitfor/parse ctrl-flow/labelledExit include/stdincludes include/includes warnings/self-assignment |
---|
210 | |
---|
211 | ${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN} |
---|
212 | ${CFACOMPILE_SYNTAX} |
---|
213 | ${if ${test}, cp ${test} ${abspath ${@}}, } |
---|
214 | |
---|
215 | # expected failures |
---|
216 | # use custom target since they require a custom define *and* have a name that doesn't match the file |
---|
217 | |
---|
218 | array-ERR1 : array.cfa ${CFACCBIN} |
---|
219 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
220 | -cp ${test} ${abspath ${@}} |
---|
221 | |
---|
222 | array-ERR2 : array.cfa ${CFACCBIN} |
---|
223 | ${CFACOMPILE_SYNTAX} -DERR2 |
---|
224 | -cp ${test} ${abspath ${@}} |
---|
225 | |
---|
226 | array-ERR3 : array.cfa ${CFACCBIN} |
---|
227 | ${CFACOMPILE_SYNTAX} -DERR3 |
---|
228 | -cp ${test} ${abspath ${@}} |
---|
229 | |
---|
230 | array-collections/dimexpr-match-c-ERRS : array-collections/dimexpr-match-c.cfa |
---|
231 | ${CFACOMPILE_SYNTAX} -DERRS |
---|
232 | -cp ${test} ${abspath ${@}} |
---|
233 | |
---|
234 | array-collections/dimexpr-match-cfa-ERRS : array-collections/dimexpr-match-cfa.cfa |
---|
235 | ${CFACOMPILE_SYNTAX} -DERRS |
---|
236 | -cp ${test} ${abspath ${@}} |
---|
237 | |
---|
238 | alloc-ERROR : alloc.cfa ${CFACCBIN} |
---|
239 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
240 | -cp ${test} ${abspath ${@}} |
---|
241 | |
---|
242 | init1-ERROR : init1.cfa ${CFACCBIN} |
---|
243 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
244 | -cp ${test} ${abspath ${@}} |
---|
245 | |
---|
246 | typedefRedef-ERR1 : typedefRedef.cfa ${CFACCBIN} |
---|
247 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
248 | -cp ${test} ${abspath ${@}} |
---|
249 | |
---|
250 | nested-types-ERR1 : nested-types.cfa ${CFACCBIN} |
---|
251 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
252 | -cp ${test} ${abspath ${@}} |
---|
253 | |
---|
254 | nested-types-ERR2 : nested-types.cfa ${CFACCBIN} |
---|
255 | ${CFACOMPILE_SYNTAX} -DERR2 |
---|
256 | -cp ${test} ${abspath ${@}} |
---|
257 | |
---|
258 | raii/memberCtors-ERR1 : raii/memberCtors.cfa ${CFACCBIN} |
---|
259 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
260 | -cp ${test} ${abspath ${@}} |
---|
261 | |
---|
262 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa ${CFACCBIN} |
---|
263 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
264 | -cp ${test} ${abspath ${@}} |
---|
265 | |
---|
266 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa ${CFACCBIN} |
---|
267 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
268 | -cp ${test} ${abspath ${@}} |
---|
269 | |
---|
270 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa ${CFACCBIN} |
---|
271 | ${CFACOMPILE_SYNTAX} -DERR2 |
---|
272 | -cp ${test} ${abspath ${@}} |
---|
273 | |
---|
274 | raii/partial-ERR1 : raii/partial.cfa ${CFACCBIN} |
---|
275 | ${CFACOMPILE_SYNTAX} -DERR1 |
---|
276 | -cp ${test} ${abspath ${@}} |
---|
277 | |
---|
278 | # Exception Tests |
---|
279 | # Test with libcfathread; it changes how storage works. |
---|
280 | |
---|
281 | exceptions/%-threads : exceptions/%.cfa ${CFACCBIN} |
---|
282 | ${CFACOMPILETEST} -include exceptions/with-threads.hfa -c -o ${abspath ${@}}.o |
---|
283 | ${CFACCLOCAL} ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} ${abspath ${@}}.o -o ${abspath ${@}} |
---|
284 | |
---|
285 | # Linking tests |
---|
286 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls) |
---|
287 | linking/linkerror : linking/linkerror.cfa ${CFACCBIN} |
---|
288 | ${CFACOMPILETEST} -O0 -c -o ${abspath ${@}}.o |
---|
289 | ${CFACCLINK} -O0 ${@}.o -o ${abspath ${@}} |
---|
290 | rm ${abspath ${@}}.o |
---|
291 | |
---|
292 | # No-warning tests |
---|
293 | # Tests to make sure that given CFA code gets emitted C code that GCC accepts without any warnings |
---|
294 | nowarn/% : nowarn/%.cfa ${CFABIN} |
---|
295 | ${CFACOMPILETEST} -Wunused-function -Wpsabi -Wall -Wextra -Werror -o ${abspath ${@}} |
---|
296 | |
---|
297 | #------------------------------------------------------------------------------ |
---|
298 | # Other targets |
---|