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 : Tue May 16 09:27:48 2023
|
---|
14 | ## Update Count : 178
|
---|
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 | DEBUG_FLAGS = -debug -g -O0
|
---|
29 |
|
---|
30 | quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
|
---|
31 |
|
---|
32 | archiveerrors=
|
---|
33 | concurrent=
|
---|
34 | timeouts=
|
---|
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 : list .validate .test_makeflags
|
---|
70 | .INTERMEDIATE : .validate .validate.cfa .test_makeflags
|
---|
71 | EXTRA_PROGRAMS = 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 | avltree/avl-private.h \
|
---|
80 | avltree/avl.h \
|
---|
81 | concurrent/clib_tls.c \
|
---|
82 | concurrent/clib.c \
|
---|
83 | configs/.in/parseconfig-all.txt \
|
---|
84 | configs/.in/parseconfig-errors.txt \
|
---|
85 | configs/.in/parseconfig-missing.txt \
|
---|
86 | exceptions/except-io.hfa \
|
---|
87 | exceptions/with-threads.hfa \
|
---|
88 | io/.in/io.data \
|
---|
89 | io/.in/many_read.data \
|
---|
90 | meta/fork+exec.hfa \
|
---|
91 | concurrent/unified_locking/mutex_test.hfa \
|
---|
92 | concurrent/channels/parallel_harness.hfa
|
---|
93 |
|
---|
94 | dist-hook:
|
---|
95 | echo "Gathering test files"
|
---|
96 | for file in `${TEST_PY} --list-dist`; do \
|
---|
97 | if test -f ${srcdir}/$${file}; then \
|
---|
98 | ${MKDIR_P} $$(dirname ${distdir}/$${file}); \
|
---|
99 | cp -df ${srcdir}/$${file} ${distdir}/$${file}; \
|
---|
100 | fi; \
|
---|
101 | done
|
---|
102 |
|
---|
103 | 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
|
---|
104 | linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
|
---|
105 | linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
|
---|
106 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program
|
---|
107 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
|
---|
108 |
|
---|
109 | #----------------------------------------------------------------------------------------------------------------
|
---|
110 |
|
---|
111 | all-local : # This name is important to automake and implies the default build target.
|
---|
112 | @+${TEST_PY} --debug=${debug} --install=${installed} --invariant --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${ARCH} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
|
---|
113 |
|
---|
114 | install : all-local # PAB only
|
---|
115 |
|
---|
116 | tests : all-local
|
---|
117 |
|
---|
118 | quick :
|
---|
119 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${ARCH} ${quick_test}
|
---|
120 |
|
---|
121 | concurrency :
|
---|
122 | @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCH} -Iconcurrent
|
---|
123 |
|
---|
124 | list :
|
---|
125 | @+${TEST_PY} --list ${concurrent}
|
---|
126 |
|
---|
127 | help :
|
---|
128 | @echo "user targets:"
|
---|
129 | @echo " Run the complete test suite."
|
---|
130 | @echo " $$ make (null) / tests [debug=yes/no] [installed=yes/no] [arch=${arch_support}]"
|
---|
131 | @echo ""
|
---|
132 | @echo " Run the short (quick) test suite."
|
---|
133 | @echo " $$ make quick [debug=yes/no] [installed=yes/no] [arch=${arch_support}]"
|
---|
134 | @echo ""
|
---|
135 | @echo " Run the concurrent test suite."
|
---|
136 | @echo " $$ make concurrency [debug=yes/no] [installed=yes/no] [arch=${arch_support}]"
|
---|
137 | @echo ""
|
---|
138 | @echo " List all tests in the test suite."
|
---|
139 | @echo " $$ make list"
|
---|
140 |
|
---|
141 | mostlyclean-local :
|
---|
142 | find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
|
---|
143 | find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
|
---|
144 | find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
|
---|
145 | rm -f ${EXTRA_PROGRAMS}
|
---|
146 | rm -rf __pycache__
|
---|
147 |
|
---|
148 | distclean-local :
|
---|
149 | find ${builddir} -path '*.Po' -delete
|
---|
150 |
|
---|
151 | .test_makeflags:
|
---|
152 | @echo "${MAKEFLAGS}"
|
---|
153 |
|
---|
154 | .validate: .validate.cfa
|
---|
155 | ${CFACOMPILE} .validate.cfa -fsyntax-only -Wall -Wextra -Werror
|
---|
156 |
|
---|
157 | .validate.cfa:
|
---|
158 | @echo "int main() { return 0; }" > ${@}
|
---|
159 |
|
---|
160 | # automake doesn't know we still need C rules so pretend like we have a C program
|
---|
161 | .dummy_hack.c:
|
---|
162 | @echo "int main() { return 0; }" > ${@}
|
---|
163 |
|
---|
164 | .dummy_hackxx.cpp:
|
---|
165 | @echo "int bar() { return 0; }" > ${@}
|
---|
166 |
|
---|
167 | #----------------------------------------------------------------------------------------------------------------
|
---|
168 |
|
---|
169 | # Use for all tests, make sure the path are correct and all flags are added
|
---|
170 | CFACOMPILETEST=${PRETTY_PATH} ${CFACOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} ${${shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'}}
|
---|
171 |
|
---|
172 | #----------------------------------------------------------------------------------------------------------------
|
---|
173 |
|
---|
174 | # implicit rule so not all test require a rule
|
---|
175 | # split into two steps to support compiling remotely using distcc
|
---|
176 | # don't use distcc to do the linking because distcc doesn't do linking
|
---|
177 | % : %.cfa ${CFACCBIN}
|
---|
178 | ${CFACOMPILETEST} -c -o ${abspath ${@}}.o -DIN_DIR="${abspath ${dir ${<}}}/.in/"
|
---|
179 | ${CFACCLINK} ${@}.o -o ${abspath ${@}}
|
---|
180 | rm ${abspath ${@}}.o
|
---|
181 |
|
---|
182 | # implicit rule for c++ test
|
---|
183 | # convient for testing the testsuite itself but not actuall used
|
---|
184 | % : %.cpp
|
---|
185 | ${PRETTY_PATH} ${CXXCOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} -o ${abspath ${@}}
|
---|
186 |
|
---|
187 | #------------------------------------------------------------------------------
|
---|
188 | # TARGETS WITH CUSTOM FLAGS
|
---|
189 | #------------------------------------------------------------------------------
|
---|
190 | # custom libs
|
---|
191 | gmp_FLAGSLD= -lgmp
|
---|
192 |
|
---|
193 | #------------------------------------------------------------------------------
|
---|
194 | # Generated code
|
---|
195 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
|
---|
196 | ${GENERATED_CODE} : % : %.cfa ${CFACCBIN}
|
---|
197 | ${CFACOMPILETEST} -CFA -XCFA -p -c -fsyntax-only -o ${abspath ${@}}
|
---|
198 |
|
---|
199 | #------------------------------------------------------------------------------
|
---|
200 | # CUSTOM TARGET
|
---|
201 | #------------------------------------------------------------------------------
|
---|
202 | # tests that just validate syntax and compiler output should be compared to stderr
|
---|
203 | CFACOMPILE_SYNTAX = ${CFACOMPILETEST} -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o ${abspath ${@}}
|
---|
204 |
|
---|
205 | SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
|
---|
206 | init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
|
---|
207 | ${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN}
|
---|
208 | ${CFACOMPILE_SYNTAX}
|
---|
209 | ${if ${test}, cp ${test} ${abspath ${@}}, }
|
---|
210 |
|
---|
211 | # expected failures
|
---|
212 | # use custom target since they require a custom define *and* have a name that doesn't match the file
|
---|
213 | alloc-ERROR : alloc.cfa ${CFACCBIN}
|
---|
214 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
215 | -cp ${test} ${abspath ${@}}
|
---|
216 |
|
---|
217 | init1-ERROR : init1.cfa ${CFACCBIN}
|
---|
218 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
219 | -cp ${test} ${abspath ${@}}
|
---|
220 |
|
---|
221 | typedefRedef-ERR1 : typedefRedef.cfa ${CFACCBIN}
|
---|
222 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
223 | -cp ${test} ${abspath ${@}}
|
---|
224 |
|
---|
225 | nested-types-ERR1 : nested-types.cfa ${CFACCBIN}
|
---|
226 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
227 | -cp ${test} ${abspath ${@}}
|
---|
228 |
|
---|
229 | nested-types-ERR2 : nested-types.cfa ${CFACCBIN}
|
---|
230 | ${CFACOMPILE_SYNTAX} -DERR2
|
---|
231 | -cp ${test} ${abspath ${@}}
|
---|
232 |
|
---|
233 | raii/memberCtors-ERR1 : raii/memberCtors.cfa ${CFACCBIN}
|
---|
234 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
235 | -cp ${test} ${abspath ${@}}
|
---|
236 |
|
---|
237 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa ${CFACCBIN}
|
---|
238 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
239 | -cp ${test} ${abspath ${@}}
|
---|
240 |
|
---|
241 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa ${CFACCBIN}
|
---|
242 | ${CFACOMPILE_SYNTAX} -DERR1
|
---|
243 | -cp ${test} ${abspath ${@}}
|
---|
244 |
|
---|
245 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa ${CFACCBIN}
|
---|
246 | ${CFACOMPILE_SYNTAX} -DERR2
|
---|
247 | -cp ${test} ${abspath ${@}}
|
---|
248 |
|
---|
249 | # Exception Tests
|
---|
250 | # Test with libcfathread; it changes how storage works.
|
---|
251 |
|
---|
252 | exceptions/%-threads : exceptions/%.cfa ${CFACCBIN}
|
---|
253 | ${CFACOMPILETEST} -include exceptions/with-threads.hfa -c -o ${abspath ${@}}.o
|
---|
254 | ${CFACCLOCAL} ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} ${abspath ${@}}.o -o ${abspath ${@}}
|
---|
255 |
|
---|
256 | # Linking tests
|
---|
257 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
|
---|
258 | linking/linkerror : linking/linkerror.cfa ${CFACCBIN}
|
---|
259 | ${CFACOMPILETEST} -O0 -c -o ${abspath ${@}}.o
|
---|
260 | ${CFACCLINK} -O0 ${@}.o -o ${abspath ${@}}
|
---|
261 | rm ${abspath ${@}}.o
|
---|
262 |
|
---|
263 | #------------------------------------------------------------------------------
|
---|
264 | # Other targets
|
---|