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