| [ef7d253] | 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
|
|---|
| [3d99498] | 13 | ## Last Modified On : Tue Nov 20 11:18:51 2018
|
|---|
| 14 | ## Update Count : 68
|
|---|
| [ef7d253] | 15 | ###############################################################################
|
|---|
| 16 |
|
|---|
| [0c1b566] | 17 | AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names
|
|---|
| [107b01a] | 18 | ACLOCAL_AMFLAGS = -I automake
|
|---|
| [f85bc15] | 19 |
|
|---|
| [bcadb26] | 20 | include $(top_srcdir)/tools/build/cfa.make
|
|---|
| [dc8511c] | 21 |
|
|---|
| [74cfe054] | 22 | DEFAULT_INCLUDES = -I${abs_srcdir}
|
|---|
| 23 |
|
|---|
| [cc640aad] | 24 | debug=yes
|
|---|
| [ff593a3] | 25 | installed=no
|
|---|
| [dcfedca] | 26 | archiveerrors=
|
|---|
| [cc640aad] | 27 |
|
|---|
| [e3a5a73] | 28 | DEBUG_FLAGS=-debug -O0
|
|---|
| 29 |
|
|---|
| [5cacf74] | 30 | quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes
|
|---|
| [be65cca] | 31 |
|
|---|
| [0ad0c55] | 32 | concurrent=
|
|---|
| [b90aace] | 33 | timeouts=
|
|---|
| [be65cca] | 34 |
|
|---|
| [5b993e0] | 35 | TEST_PY = python3 ${builddir}/test.py
|
|---|
| [f85bc15] | 36 |
|
|---|
| [ef7d253] | 37 | # applies to both programs
|
|---|
| [d65f92c] | 38 | # since automake doesn't have support for CFA we have to
|
|---|
| [b8f6002] | 39 | AM_CFLAGS = $(if $(test), 2> $(test), ) \
|
|---|
| [87fc1b4] | 40 | -fdebug-prefix-map=$(abspath ${abs_srcdir})= \
|
|---|
| 41 | -fdebug-prefix-map=/tmp= \
|
|---|
| [b8f6002] | 42 | -g \
|
|---|
| 43 | -Wall \
|
|---|
| 44 | -Wno-unused-function \
|
|---|
| 45 | -quiet @CFA_FLAGS@ \
|
|---|
| [f806b61] | 46 | -DIN_DIR="${abs_srcdir}/.in/"
|
|---|
| [7c03d6d] | 47 |
|
|---|
| [7215000] | 48 | AM_CFAFLAGS = -XCFA --deterministic-out
|
|---|
| 49 |
|
|---|
| [158b026] | 50 | # get the desired cfa to test
|
|---|
| 51 | TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
|
|---|
| 52 |
|
|---|
| [34e1494] | 53 | # adjust CC to current flags
|
|---|
| [ee0bfa9] | 54 | CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
|
|---|
| [d65f92c] | 55 | CFACC = $(CC)
|
|---|
| [ef7d253] | 56 |
|
|---|
| [34e1494] | 57 | # get local binary for depedencies
|
|---|
| 58 | CFACCBIN = @CFACC@
|
|---|
| 59 |
|
|---|
| 60 | # adjusted CC but without the actual distcc call
|
|---|
| [ee0bfa9] | 61 | CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
|
|---|
| [673eb7a] | 62 | CFACCLINK = $(CFACCLOCAL) $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'))
|
|---|
| [34e1494] | 63 |
|
|---|
| [e16797c] | 64 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
|
|---|
| [f7d3215] | 65 |
|
|---|
| [28582b2] | 66 | .PHONY: list .validate
|
|---|
| [1e995d6] | 67 | .INTERMEDIATE: .validate .validate.cfa
|
|---|
| [107b01a] | 68 | EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
|
|---|
| [44f44617] | 69 |
|
|---|
| [107b01a] | 70 | 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
|
|---|
| [2b10f95] | 71 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program
|
|---|
| [b7fe2e6] | 72 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
|
|---|
| [a0dcd2e] | 73 |
|
|---|
| [73abe95] | 74 | #----------------------------------------------------------------------------------------------------------------
|
|---|
| [927e9ce] | 75 | all-local :
|
|---|
| [5c4a473] | 76 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
|
|---|
| [df42128] | 77 |
|
|---|
| 78 | all-tests :
|
|---|
| [5c4a473] | 79 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
|
|---|
| [927e9ce] | 80 |
|
|---|
| 81 | clean-local :
|
|---|
| [a6dd5b0] | 82 | rm -f ${EXTRA_PROGRAMS}
|
|---|
| [927e9ce] | 83 |
|
|---|
| 84 | list :
|
|---|
| [f85bc15] | 85 | @+${TEST_PY} --list ${concurrent}
|
|---|
| [927e9ce] | 86 |
|
|---|
| [1e995d6] | 87 | .validate: .validate.cfa
|
|---|
| 88 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
|
|---|
| 89 |
|
|---|
| 90 | .validate.cfa:
|
|---|
| 91 | @echo "int main() { return 0; }" > ${@}
|
|---|
| [28582b2] | 92 |
|
|---|
| [107b01a] | 93 | # automake doesn't know we still need C rules so pretend like we have a C program
|
|---|
| 94 | .dummy_hack.c:
|
|---|
| [28582b2] | 95 | @echo "int main() { return 0; }" > ${@}
|
|---|
| 96 |
|
|---|
| [2b10f95] | 97 | .dummy_hackxx.cpp:
|
|---|
| 98 | @echo "int bar() { return 0; }" > ${@}
|
|---|
| 99 |
|
|---|
| [026a0f5] | 100 | concurrency :
|
|---|
| [a5121bf] | 101 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent
|
|---|
| [026a0f5] | 102 |
|
|---|
| [73abe95] | 103 | #----------------------------------------------------------------------------------------------------------------
|
|---|
| [dc8511c] | 104 |
|
|---|
| [e16797c] | 105 | # Use for all tests, make sure the path are correct and all flags are added
|
|---|
| [34e1494] | 106 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
|
|---|
| [d9b499c] | 107 |
|
|---|
| [e16797c] | 108 | #----------------------------------------------------------------------------------------------------------------
|
|---|
| [a843067] | 109 |
|
|---|
| [e16797c] | 110 | # implicit rule so not all test require a rule
|
|---|
| [15f9c8e] | 111 | # split into two steps to support compiling remotely using distcc
|
|---|
| [34e1494] | 112 | # don't use distcc to do the linking because distcc doesn't do linking
|
|---|
| [d65f92c] | 113 | % : %.cfa $(CFACCBIN)
|
|---|
| [7009b9b] | 114 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o
|
|---|
| [673eb7a] | 115 | $(CFACCLINK) ${@}.o -o $(abspath ${@})
|
|---|
| [468c5aa] | 116 | rm $(abspath ${@}).o
|
|---|
| [f7d3215] | 117 |
|
|---|
| [34e1494] | 118 | # implicit rule for c++ test
|
|---|
| 119 | # convient for testing the testsuite itself but not actuall used
|
|---|
| [e16797c] | 120 | % : %.cpp
|
|---|
| 121 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
|
|---|
| [4c8f86b3] | 122 |
|
|---|
| [f7d3215] | 123 | #------------------------------------------------------------------------------
|
|---|
| [34e1494] | 124 | # TARGETS WITH CUSTOM FLAGS
|
|---|
| [e16797c] | 125 | #------------------------------------------------------------------------------
|
|---|
| [34e1494] | 126 | # custom libs
|
|---|
| 127 | gmp_FLAGSLD= -lgmp
|
|---|
| [dc8511c] | 128 |
|
|---|
| [e16797c] | 129 | #------------------------------------------------------------------------------
|
|---|
| [34e1494] | 130 | # Generated code
|
|---|
| 131 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
|
|---|
| 132 | $(GENERATED_CODE): % : %.cfa $(CFACCBIN)
|
|---|
| 133 | $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 134 |
|
|---|
| 135 | # Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
|
|---|
| 136 | EXPECT_STDERR = builtins/sync warnings/self-assignment
|
|---|
| 137 | $(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
|
|---|
| 138 | $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
|
|---|
| [486341f] | 139 |
|
|---|
| [e16797c] | 140 | #------------------------------------------------------------------------------
|
|---|
| 141 | # CUSTOM TARGET
|
|---|
| 142 | #------------------------------------------------------------------------------
|
|---|
| [87fc1b4] | 143 | # tests that just validate syntax
|
|---|
| 144 | expression : expression.cfa $(CFACCBIN)
|
|---|
| [2aa25cc2] | 145 | $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
|
|---|
| [87fc1b4] | 146 |
|
|---|
| [34e1494] | 147 | # expected failures
|
|---|
| 148 | # use custom target since they require a custom define and custom dependencies
|
|---|
| 149 | alloc-ERROR : alloc.cfa $(CFACCBIN)
|
|---|
| 150 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [b93a3de] | 151 |
|
|---|
| [34e1494] | 152 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
|
|---|
| 153 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [e2c70ab] | 154 |
|
|---|
| [34e1494] | 155 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
|
|---|
| 156 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [49e1275] | 157 |
|
|---|
| [34e1494] | 158 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
|
|---|
| 159 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [49e1275] | 160 |
|
|---|
| [34e1494] | 161 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
|
|---|
| 162 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [cdbfab0] | 163 |
|
|---|
| [34e1494] | 164 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
|
|---|
| 165 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [80e85829] | 166 |
|
|---|
| [34e1494] | 167 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
|
|---|
| 168 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [80e85829] | 169 |
|
|---|
| [34e1494] | 170 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
|
|---|
| 171 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| [e16797c] | 172 |
|
|---|
| [5715d43] | 173 | # Exception Tests
|
|---|
| 174 | # Test with libcfathread; it changes how storage works.
|
|---|
| 175 |
|
|---|
| 176 | exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
|
|---|
| 177 | $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
|
|---|
| 178 | $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
|
|---|
| 179 |
|
|---|
| [673eb7a] | 180 | # Linking tests
|
|---|
| 181 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
|
|---|
| 182 | linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
|
|---|
| 183 | $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o
|
|---|
| 184 | $(CFACCLINK) -O0 ${@}.o -o $(abspath ${@})
|
|---|
| [a951171] | 185 | rm $(abspath ${@}).o
|
|---|
| [673eb7a] | 186 |
|
|---|
| [34e1494] | 187 | #------------------------------------------------------------------------------
|
|---|
| 188 | # Other targets
|
|---|