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 Jun 5 14:49:25 2021 |
---|
14 | ## Update Count : 92 |
---|
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 | archiveerrors= |
---|
27 | |
---|
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 | concurrent= |
---|
33 | timeouts= |
---|
34 | |
---|
35 | TEST_PY = python3 ${builddir}/test.py |
---|
36 | |
---|
37 | # applies to both programs |
---|
38 | # since automake doesn't have support for CFA we have to |
---|
39 | AM_CFLAGS = $(if $(test), 2> $(test), ) \ |
---|
40 | -fdebug-prefix-map=$(abspath ${abs_srcdir})= \ |
---|
41 | -fdebug-prefix-map=/tmp= \ |
---|
42 | -fno-diagnostics-show-caret \ |
---|
43 | -g \ |
---|
44 | -Wall \ |
---|
45 | -Werror=return-type \ |
---|
46 | -Wno-unused-function \ |
---|
47 | -Wno-psabi \ |
---|
48 | -quiet @CFA_FLAGS@ |
---|
49 | |
---|
50 | AM_CFAFLAGS = -XCFA --deterministic-out |
---|
51 | |
---|
52 | # get the desired cfa to test |
---|
53 | TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@) |
---|
54 | |
---|
55 | # adjust CC to current flags |
---|
56 | CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) |
---|
57 | CFACC = $(CC) |
---|
58 | |
---|
59 | # get local binary for depedencies |
---|
60 | CFACCBIN = @CFACC@ |
---|
61 | |
---|
62 | # adjusted CC but without the actual distcc call |
---|
63 | CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) |
---|
64 | CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) |
---|
65 | |
---|
66 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && |
---|
67 | |
---|
68 | .PHONY: list .validate .test_makeflags |
---|
69 | .INTERMEDIATE: .validate .validate.cfa .test_makeflags |
---|
70 | EXTRA_PROGRAMS = avl_test linkonce .dummy_hack # build but do not install |
---|
71 | EXTRA_DIST = test.py \ |
---|
72 | pybin/__init__.py \ |
---|
73 | pybin/print-core.gdb \ |
---|
74 | pybin/settings.py \ |
---|
75 | pybin/test_run.py \ |
---|
76 | pybin/tools.py \ |
---|
77 | long_tests.hfa \ |
---|
78 | .in/parseconfig-all.txt \ |
---|
79 | .in/parseconfig-errors.txt \ |
---|
80 | .in/parseconfig-missing.txt \ |
---|
81 | io/.in/io.data \ |
---|
82 | io/.in/many_read.data \ |
---|
83 | avltree/avl.h \ |
---|
84 | avltree/avl-private.h \ |
---|
85 | concurrent/clib.c \ |
---|
86 | concurrent/clib_tls.c \ |
---|
87 | exceptions/with-threads.hfa \ |
---|
88 | exceptions/except-io.hfa \ |
---|
89 | unified_locking/mutex_test.hfa |
---|
90 | |
---|
91 | dist-hook: |
---|
92 | echo "Gathering test files" |
---|
93 | for file in `${TEST_PY} --list-dist`; do \ |
---|
94 | if test -f ${srcdir}/$${file}; then \ |
---|
95 | $(MKDIR_P) $$(dirname ${distdir}/$${file}); \ |
---|
96 | cp -df ${srcdir}/$${file} ${distdir}/$${file}; \ |
---|
97 | fi; \ |
---|
98 | done |
---|
99 | |
---|
100 | 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 |
---|
101 | linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa |
---|
102 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program |
---|
103 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp |
---|
104 | |
---|
105 | #---------------------------------------------------------------------------------------------------------------- |
---|
106 | all-local : |
---|
107 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} |
---|
108 | |
---|
109 | all-tests : |
---|
110 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program |
---|
111 | |
---|
112 | mostlyclean-local : |
---|
113 | find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete |
---|
114 | find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete |
---|
115 | find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete |
---|
116 | rm -f ${EXTRA_PROGRAMS} |
---|
117 | rm -rf __pycache__ |
---|
118 | |
---|
119 | distclean-local : |
---|
120 | find ${builddir} -path '*.Po' -delete |
---|
121 | |
---|
122 | list : |
---|
123 | @+${TEST_PY} --list ${concurrent} |
---|
124 | |
---|
125 | .test_makeflags: |
---|
126 | @echo "${MAKEFLAGS}" |
---|
127 | |
---|
128 | .validate: .validate.cfa |
---|
129 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror |
---|
130 | |
---|
131 | .validate.cfa: |
---|
132 | @echo "int main() { return 0; }" > ${@} |
---|
133 | |
---|
134 | # automake doesn't know we still need C rules so pretend like we have a C program |
---|
135 | .dummy_hack.c: |
---|
136 | @echo "int main() { return 0; }" > ${@} |
---|
137 | |
---|
138 | .dummy_hackxx.cpp: |
---|
139 | @echo "int bar() { return 0; }" > ${@} |
---|
140 | |
---|
141 | concurrency : |
---|
142 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent |
---|
143 | |
---|
144 | #---------------------------------------------------------------------------------------------------------------- |
---|
145 | |
---|
146 | # Use for all tests, make sure the path are correct and all flags are added |
---|
147 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g')) |
---|
148 | |
---|
149 | #---------------------------------------------------------------------------------------------------------------- |
---|
150 | |
---|
151 | # implicit rule so not all test require a rule |
---|
152 | # split into two steps to support compiling remotely using distcc |
---|
153 | # don't use distcc to do the linking because distcc doesn't do linking |
---|
154 | % : %.cfa $(CFACCBIN) |
---|
155 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o -DIN_DIR="$(abspath $(dir ${<}))/.in/" |
---|
156 | $(CFACCLINK) ${@}.o -o $(abspath ${@}) |
---|
157 | rm $(abspath ${@}).o |
---|
158 | |
---|
159 | # implicit rule for c++ test |
---|
160 | # convient for testing the testsuite itself but not actuall used |
---|
161 | % : %.cpp |
---|
162 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) |
---|
163 | |
---|
164 | #------------------------------------------------------------------------------ |
---|
165 | # TARGETS WITH CUSTOM FLAGS |
---|
166 | #------------------------------------------------------------------------------ |
---|
167 | # custom libs |
---|
168 | gmp_FLAGSLD= -lgmp |
---|
169 | |
---|
170 | #------------------------------------------------------------------------------ |
---|
171 | # Generated code |
---|
172 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions |
---|
173 | $(GENERATED_CODE): % : %.cfa $(CFACCBIN) |
---|
174 | $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@}) |
---|
175 | |
---|
176 | #------------------------------------------------------------------------------ |
---|
177 | # CUSTOM TARGET |
---|
178 | #------------------------------------------------------------------------------ |
---|
179 | # tests that just validate syntax and compiler output should be compared to stderr |
---|
180 | CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@}) |
---|
181 | |
---|
182 | SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall \ |
---|
183 | init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment |
---|
184 | $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN) |
---|
185 | $(CFACOMPILE_SYNTAX) |
---|
186 | $(if $(test), cp $(test) $(abspath ${@}), ) |
---|
187 | |
---|
188 | # expected failures |
---|
189 | # use custom target since they require a custom define *and* have a name that doesn't match the file |
---|
190 | alloc-ERROR : alloc.cfa $(CFACCBIN) |
---|
191 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
192 | -cp $(test) $(abspath ${@}) |
---|
193 | |
---|
194 | init1-ERROR : init1.cfa $(CFACCBIN) |
---|
195 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
196 | -cp $(test) $(abspath ${@}) |
---|
197 | |
---|
198 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN) |
---|
199 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
200 | -cp $(test) $(abspath ${@}) |
---|
201 | |
---|
202 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN) |
---|
203 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
204 | -cp $(test) $(abspath ${@}) |
---|
205 | |
---|
206 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN) |
---|
207 | $(CFACOMPILE_SYNTAX) -DERR2 |
---|
208 | -cp $(test) $(abspath ${@}) |
---|
209 | |
---|
210 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN) |
---|
211 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
212 | -cp $(test) $(abspath ${@}) |
---|
213 | |
---|
214 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN) |
---|
215 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
216 | -cp $(test) $(abspath ${@}) |
---|
217 | |
---|
218 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
219 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
220 | -cp $(test) $(abspath ${@}) |
---|
221 | |
---|
222 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
223 | $(CFACOMPILE_SYNTAX) -DERR2 |
---|
224 | -cp $(test) $(abspath ${@}) |
---|
225 | |
---|
226 | # Exception Tests |
---|
227 | # Test with libcfathread; it changes how storage works. |
---|
228 | |
---|
229 | exceptions/%-threads : exceptions/%.cfa $(CFACCBIN) |
---|
230 | $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o |
---|
231 | $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@}) |
---|
232 | |
---|
233 | # Linking tests |
---|
234 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls) |
---|
235 | linking/linkerror : linking/linkerror.cfa $(CFACCBIN) |
---|
236 | $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o |
---|
237 | $(CFACCLINK) -O0 ${@}.o -o $(abspath ${@}) |
---|
238 | rm $(abspath ${@}).o |
---|
239 | |
---|
240 | #------------------------------------------------------------------------------ |
---|
241 | # Other targets |
---|