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 Nov 20 11:18:51 2018
|
---|
14 | ## Update Count : 68
|
---|
15 | ###############################################################################
|
---|
16 |
|
---|
17 | AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names
|
---|
18 | ACLOCAL_AMFLAGS = -I automake
|
---|
19 |
|
---|
20 | include $(top_srcdir)/src/cfa.make
|
---|
21 |
|
---|
22 | debug=yes
|
---|
23 | installed=no
|
---|
24 | archiveerrors=
|
---|
25 |
|
---|
26 | DEBUG_FLAGS=-debug -O0
|
---|
27 |
|
---|
28 | quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes
|
---|
29 |
|
---|
30 | concurrent=
|
---|
31 | timeouts=
|
---|
32 |
|
---|
33 | TEST_PY = python3 ${builddir}/test.py
|
---|
34 |
|
---|
35 | # applies to both programs
|
---|
36 | # since automake doesn't have support for CFA we have to
|
---|
37 | AM_CFLAGS = $(if $(test), 2> $(test), ) \
|
---|
38 | -g \
|
---|
39 | -Wall \
|
---|
40 | -Wno-unused-function \
|
---|
41 | -quiet @CFA_FLAGS@ \
|
---|
42 | -DIN_DIR="${abs_srcdir}/.in/"
|
---|
43 |
|
---|
44 | # get the desired cfa to test
|
---|
45 | TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
|
---|
46 |
|
---|
47 | # adjust CC to current flags
|
---|
48 | CC = $(if $(ifeq $(DISTCC_CFA_PATH),yes),distcc $(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
|
---|
49 | CFACC = $(CC)
|
---|
50 |
|
---|
51 | # get local binary for depedencies
|
---|
52 | CFACCBIN = @CFACC@
|
---|
53 |
|
---|
54 | # adjusted CC but without the actual distcc call
|
---|
55 | CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
|
---|
56 |
|
---|
57 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
|
---|
58 |
|
---|
59 | .PHONY: list .validate
|
---|
60 | .INTERMEDIATE: .validate .validate.cfa
|
---|
61 | EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
|
---|
62 |
|
---|
63 | 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
|
---|
64 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program
|
---|
65 | _dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
|
---|
66 |
|
---|
67 | #----------------------------------------------------------------------------------------------------------------
|
---|
68 | all-local :
|
---|
69 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
|
---|
70 |
|
---|
71 | all-tests :
|
---|
72 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
|
---|
73 |
|
---|
74 | clean-local :
|
---|
75 | rm -f ${EXTRA_PROGRAMS}
|
---|
76 |
|
---|
77 | list :
|
---|
78 | @+${TEST_PY} --list ${concurrent}
|
---|
79 |
|
---|
80 | .validate: .validate.cfa
|
---|
81 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
|
---|
82 |
|
---|
83 | .validate.cfa:
|
---|
84 | @echo "int main() { return 0; }" > ${@}
|
---|
85 |
|
---|
86 | # automake doesn't know we still need C rules so pretend like we have a C program
|
---|
87 | .dummy_hack.c:
|
---|
88 | @echo "int main() { return 0; }" > ${@}
|
---|
89 |
|
---|
90 | .dummy_hackxx.cpp:
|
---|
91 | @echo "int bar() { return 0; }" > ${@}
|
---|
92 |
|
---|
93 | concurrency :
|
---|
94 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent
|
---|
95 |
|
---|
96 | #----------------------------------------------------------------------------------------------------------------
|
---|
97 |
|
---|
98 | # Use for all tests, make sure the path are correct and all flags are added
|
---|
99 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
|
---|
100 |
|
---|
101 | #----------------------------------------------------------------------------------------------------------------
|
---|
102 |
|
---|
103 | # implicit rule so not all test require a rule
|
---|
104 | # split into two steps to support compiling remotely using distcc
|
---|
105 | # don't use distcc to do the linking because distcc doesn't do linking
|
---|
106 | % : %.cfa $(CFACCBIN)
|
---|
107 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o
|
---|
108 | $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
|
---|
109 |
|
---|
110 | # implicit rule for c++ test
|
---|
111 | # convient for testing the testsuite itself but not actuall used
|
---|
112 | % : %.cpp
|
---|
113 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
|
---|
114 |
|
---|
115 | #------------------------------------------------------------------------------
|
---|
116 | # TARGETS WITH CUSTOM FLAGS
|
---|
117 | #------------------------------------------------------------------------------
|
---|
118 | # custom libs
|
---|
119 | gmp_FLAGSLD= -lgmp
|
---|
120 |
|
---|
121 | #------------------------------------------------------------------------------
|
---|
122 | # Generated code
|
---|
123 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
|
---|
124 | $(GENERATED_CODE): % : %.cfa $(CFACCBIN)
|
---|
125 | $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
|
---|
126 |
|
---|
127 | # Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
|
---|
128 | EXPECT_STDERR = builtins/sync warnings/self-assignment
|
---|
129 | $(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
|
---|
130 | $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
|
---|
131 |
|
---|
132 | #------------------------------------------------------------------------------
|
---|
133 | # CUSTOM TARGET
|
---|
134 | #------------------------------------------------------------------------------
|
---|
135 | # expected failures
|
---|
136 | # use custom target since they require a custom define and custom dependencies
|
---|
137 | alloc-ERROR : alloc.cfa $(CFACCBIN)
|
---|
138 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
---|
139 |
|
---|
140 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
|
---|
141 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
---|
142 |
|
---|
143 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
|
---|
144 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
---|
145 |
|
---|
146 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
|
---|
147 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
|
---|
148 |
|
---|
149 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
|
---|
150 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
---|
151 |
|
---|
152 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
|
---|
153 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
---|
154 |
|
---|
155 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
|
---|
156 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
---|
157 |
|
---|
158 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
|
---|
159 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
|
---|
160 |
|
---|
161 | #------------------------------------------------------------------------------
|
---|
162 | # Other targets
|
---|