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