[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 |
---|
[ee858bf] | 13 | ## Last Modified On : Fri Oct 9 23:13:07 2020 |
---|
| 14 | ## Update Count : 86 |
---|
[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= \ |
---|
[0a19c51] | 42 | -fno-diagnostics-show-caret \ |
---|
[b8f6002] | 43 | -g \ |
---|
| 44 | -Wall \ |
---|
| 45 | -Wno-unused-function \ |
---|
| 46 | -quiet @CFA_FLAGS@ \ |
---|
[f806b61] | 47 | -DIN_DIR="${abs_srcdir}/.in/" |
---|
[7c03d6d] | 48 | |
---|
[7215000] | 49 | AM_CFAFLAGS = -XCFA --deterministic-out |
---|
| 50 | |
---|
[158b026] | 51 | # get the desired cfa to test |
---|
| 52 | TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@) |
---|
| 53 | |
---|
[34e1494] | 54 | # adjust CC to current flags |
---|
[8a71d8e] | 55 | CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) |
---|
[d65f92c] | 56 | CFACC = $(CC) |
---|
[ef7d253] | 57 | |
---|
[34e1494] | 58 | # get local binary for depedencies |
---|
| 59 | CFACCBIN = @CFACC@ |
---|
| 60 | |
---|
| 61 | # adjusted CC but without the actual distcc call |
---|
[ee0bfa9] | 62 | CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) |
---|
[fe94e708] | 63 | CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) |
---|
[34e1494] | 64 | |
---|
[e16797c] | 65 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && |
---|
[f7d3215] | 66 | |
---|
[28582b2] | 67 | .PHONY: list .validate |
---|
[1e995d6] | 68 | .INTERMEDIATE: .validate .validate.cfa |
---|
[107b01a] | 69 | EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install |
---|
[44f44617] | 70 | |
---|
[107b01a] | 71 | 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] | 72 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program |
---|
[b7fe2e6] | 73 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp |
---|
[a0dcd2e] | 74 | |
---|
[73abe95] | 75 | #---------------------------------------------------------------------------------------------------------------- |
---|
[927e9ce] | 76 | all-local : |
---|
[5c4a473] | 77 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} |
---|
[df42128] | 78 | |
---|
| 79 | all-tests : |
---|
[5c4a473] | 80 | @+${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] | 81 | |
---|
| 82 | clean-local : |
---|
[a6dd5b0] | 83 | rm -f ${EXTRA_PROGRAMS} |
---|
[927e9ce] | 84 | |
---|
| 85 | list : |
---|
[f85bc15] | 86 | @+${TEST_PY} --list ${concurrent} |
---|
[927e9ce] | 87 | |
---|
[1e995d6] | 88 | .validate: .validate.cfa |
---|
| 89 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror |
---|
| 90 | |
---|
| 91 | .validate.cfa: |
---|
| 92 | @echo "int main() { return 0; }" > ${@} |
---|
[28582b2] | 93 | |
---|
[107b01a] | 94 | # automake doesn't know we still need C rules so pretend like we have a C program |
---|
| 95 | .dummy_hack.c: |
---|
[28582b2] | 96 | @echo "int main() { return 0; }" > ${@} |
---|
| 97 | |
---|
[2b10f95] | 98 | .dummy_hackxx.cpp: |
---|
| 99 | @echo "int bar() { return 0; }" > ${@} |
---|
| 100 | |
---|
[026a0f5] | 101 | concurrency : |
---|
[a5121bf] | 102 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent |
---|
[026a0f5] | 103 | |
---|
[73abe95] | 104 | #---------------------------------------------------------------------------------------------------------------- |
---|
[dc8511c] | 105 | |
---|
[e16797c] | 106 | # Use for all tests, make sure the path are correct and all flags are added |
---|
[34e1494] | 107 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g')) |
---|
[d9b499c] | 108 | |
---|
[e16797c] | 109 | #---------------------------------------------------------------------------------------------------------------- |
---|
[a843067] | 110 | |
---|
[e16797c] | 111 | # implicit rule so not all test require a rule |
---|
[15f9c8e] | 112 | # split into two steps to support compiling remotely using distcc |
---|
[34e1494] | 113 | # don't use distcc to do the linking because distcc doesn't do linking |
---|
[d65f92c] | 114 | % : %.cfa $(CFACCBIN) |
---|
[7009b9b] | 115 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o |
---|
[673eb7a] | 116 | $(CFACCLINK) ${@}.o -o $(abspath ${@}) |
---|
[468c5aa] | 117 | rm $(abspath ${@}).o |
---|
[f7d3215] | 118 | |
---|
[34e1494] | 119 | # implicit rule for c++ test |
---|
| 120 | # convient for testing the testsuite itself but not actuall used |
---|
[e16797c] | 121 | % : %.cpp |
---|
| 122 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) |
---|
[4c8f86b3] | 123 | |
---|
[f7d3215] | 124 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 125 | # TARGETS WITH CUSTOM FLAGS |
---|
[e16797c] | 126 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 127 | # custom libs |
---|
| 128 | gmp_FLAGSLD= -lgmp |
---|
[dc8511c] | 129 | |
---|
[e16797c] | 130 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 131 | # Generated code |
---|
| 132 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions |
---|
| 133 | $(GENERATED_CODE): % : %.cfa $(CFACCBIN) |
---|
| 134 | $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@}) |
---|
| 135 | |
---|
[e16797c] | 136 | #------------------------------------------------------------------------------ |
---|
| 137 | # CUSTOM TARGET |
---|
| 138 | #------------------------------------------------------------------------------ |
---|
[66812dd] | 139 | # tests that just validate syntax and compiler output should be compared to stderr |
---|
[e6cfb4e2] | 140 | CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@}) |
---|
[40c81e5] | 141 | |
---|
| 142 | SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall \ |
---|
[ee858bf] | 143 | init1 limits nested-types stdincludes cast labelledExit array builtins/sync warnings/self-assignment |
---|
[66812dd] | 144 | $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 145 | $(CFACOMPILE_SYNTAX) |
---|
| 146 | $(if $(test), cp $(test) $(abspath ${@}), ) |
---|
[87fc1b4] | 147 | |
---|
[34e1494] | 148 | # expected failures |
---|
[e6cfb4e2] | 149 | # use custom target since they require a custom define *and* have a name that doesn't match the file |
---|
[34e1494] | 150 | alloc-ERROR : alloc.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 151 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 152 | -cp $(test) $(abspath ${@}) |
---|
[b93a3de] | 153 | |
---|
[ee858bf] | 154 | init1-ERROR : init1.cfa $(CFACCBIN) |
---|
| 155 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 156 | -cp $(test) $(abspath ${@}) |
---|
| 157 | |
---|
[34e1494] | 158 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 159 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 160 | -cp $(test) $(abspath ${@}) |
---|
[e2c70ab] | 161 | |
---|
[34e1494] | 162 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 163 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 164 | -cp $(test) $(abspath ${@}) |
---|
[49e1275] | 165 | |
---|
[34e1494] | 166 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 167 | $(CFACOMPILE_SYNTAX) -DERR2 |
---|
| 168 | -cp $(test) $(abspath ${@}) |
---|
[49e1275] | 169 | |
---|
[34e1494] | 170 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 171 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 172 | -cp $(test) $(abspath ${@}) |
---|
[cdbfab0] | 173 | |
---|
[34e1494] | 174 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 175 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 176 | -cp $(test) $(abspath ${@}) |
---|
[80e8582] | 177 | |
---|
[34e1494] | 178 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 179 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 180 | -cp $(test) $(abspath ${@}) |
---|
[80e8582] | 181 | |
---|
[34e1494] | 182 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 183 | $(CFACOMPILE_SYNTAX) -DERR2 |
---|
| 184 | -cp $(test) $(abspath ${@}) |
---|
[e16797c] | 185 | |
---|
[5715d43] | 186 | # Exception Tests |
---|
| 187 | # Test with libcfathread; it changes how storage works. |
---|
| 188 | |
---|
| 189 | exceptions/%-threads : exceptions/%.cfa $(CFACCBIN) |
---|
| 190 | $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o |
---|
| 191 | $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@}) |
---|
| 192 | |
---|
[673eb7a] | 193 | # Linking tests |
---|
| 194 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls) |
---|
| 195 | linking/linkerror : linking/linkerror.cfa $(CFACCBIN) |
---|
| 196 | $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o |
---|
| 197 | $(CFACCLINK) -O0 ${@}.o -o $(abspath ${@}) |
---|
[a951171] | 198 | rm $(abspath ${@}).o |
---|
[673eb7a] | 199 | |
---|
[34e1494] | 200 | #------------------------------------------------------------------------------ |
---|
| 201 | # Other targets |
---|