[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 |
---|
[35d1de5] | 13 | ## Last Modified On : Fri Feb 3 23:06:44 2023 |
---|
| 14 | ## Update Count : 94 |
---|
[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 | |
---|
[36fbaeca] | 28 | DEBUG_FLAGS=-debug -g -O0 |
---|
[e3a5a73] | 29 | |
---|
[ff7b2de] | 30 | quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable |
---|
[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 \ |
---|
[850aff1] | 45 | -Werror=return-type \ |
---|
[b8f6002] | 46 | -Wno-unused-function \ |
---|
[36fbaeca] | 47 | -Wno-psabi \ |
---|
[b44959f] | 48 | -quiet @CFA_FLAGS@ |
---|
[7c03d6d] | 49 | |
---|
[7215000] | 50 | AM_CFAFLAGS = -XCFA --deterministic-out |
---|
| 51 | |
---|
[158b026] | 52 | # get the desired cfa to test |
---|
| 53 | TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@) |
---|
| 54 | |
---|
[34e1494] | 55 | # adjust CC to current flags |
---|
[e2e31c6] | 56 | CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) |
---|
[d65f92c] | 57 | CFACC = $(CC) |
---|
[ef7d253] | 58 | |
---|
[34e1494] | 59 | # get local binary for depedencies |
---|
| 60 | CFACCBIN = @CFACC@ |
---|
| 61 | |
---|
| 62 | # adjusted CC but without the actual distcc call |
---|
[e173d3c] | 63 | CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) |
---|
[fe94e708] | 64 | CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) |
---|
[34e1494] | 65 | |
---|
[e16797c] | 66 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && |
---|
[f7d3215] | 67 | |
---|
[fc01219] | 68 | .PHONY: list .validate .test_makeflags |
---|
| 69 | .INTERMEDIATE: .validate .validate.cfa .test_makeflags |
---|
[258aaab8] | 70 | EXTRA_PROGRAMS = avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install |
---|
[a468e1e9] | 71 | EXTRA_DIST = test.py \ |
---|
| 72 | pybin/__init__.py \ |
---|
| 73 | pybin/print-core.gdb \ |
---|
| 74 | pybin/settings.py \ |
---|
| 75 | pybin/test_run.py \ |
---|
| 76 | pybin/tools.py \ |
---|
| 77 | long_tests.hfa \ |
---|
[d0fa494] | 78 | avltree/avl-private.h \ |
---|
| 79 | avltree/avl.h \ |
---|
| 80 | concurrent/clib_tls.c \ |
---|
| 81 | concurrent/clib.c \ |
---|
[d0a00a5a] | 82 | configs/.in/parseconfig-all.txt \ |
---|
| 83 | configs/.in/parseconfig-errors.txt \ |
---|
| 84 | configs/.in/parseconfig-missing.txt \ |
---|
[d0fa494] | 85 | exceptions/except-io.hfa \ |
---|
| 86 | exceptions/with-threads.hfa \ |
---|
[b44959f] | 87 | io/.in/io.data \ |
---|
[3bd5ca7] | 88 | io/.in/many_read.data \ |
---|
[d0fa494] | 89 | meta/fork+exec.hfa \ |
---|
[dbd47d6] | 90 | concurrent/unified_locking/mutex_test.hfa \ |
---|
[35d1de5] | 91 | concurrent/channels/parallel_harness.hfa |
---|
[a468e1e9] | 92 | |
---|
| 93 | dist-hook: |
---|
| 94 | echo "Gathering test files" |
---|
| 95 | for file in `${TEST_PY} --list-dist`; do \ |
---|
| 96 | if test -f ${srcdir}/$${file}; then \ |
---|
| 97 | $(MKDIR_P) $$(dirname ${distdir}/$${file}); \ |
---|
| 98 | cp -df ${srcdir}/$${file} ${distdir}/$${file}; \ |
---|
| 99 | fi; \ |
---|
| 100 | done |
---|
[44f44617] | 101 | |
---|
[107b01a] | 102 | 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 |
---|
[aff7e86] | 103 | linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa |
---|
[258aaab8] | 104 | linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa |
---|
[2b10f95] | 105 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program |
---|
[b7fe2e6] | 106 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp |
---|
[a0dcd2e] | 107 | |
---|
[73abe95] | 108 | #---------------------------------------------------------------------------------------------------------------- |
---|
[927e9ce] | 109 | all-local : |
---|
[5c4a473] | 110 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} |
---|
[df42128] | 111 | |
---|
| 112 | all-tests : |
---|
[5c4a473] | 113 | @+${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] | 114 | |
---|
[2a59655] | 115 | mostlyclean-local : |
---|
[0783909] | 116 | find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete |
---|
| 117 | find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete |
---|
| 118 | find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete |
---|
[a6dd5b0] | 119 | rm -f ${EXTRA_PROGRAMS} |
---|
[2a59655] | 120 | rm -rf __pycache__ |
---|
| 121 | |
---|
| 122 | distclean-local : |
---|
| 123 | find ${builddir} -path '*.Po' -delete |
---|
[927e9ce] | 124 | |
---|
| 125 | list : |
---|
[f85bc15] | 126 | @+${TEST_PY} --list ${concurrent} |
---|
[927e9ce] | 127 | |
---|
[fc01219] | 128 | .test_makeflags: |
---|
| 129 | @echo "${MAKEFLAGS}" |
---|
| 130 | |
---|
[1e995d6] | 131 | .validate: .validate.cfa |
---|
| 132 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror |
---|
| 133 | |
---|
| 134 | .validate.cfa: |
---|
| 135 | @echo "int main() { return 0; }" > ${@} |
---|
[28582b2] | 136 | |
---|
[107b01a] | 137 | # automake doesn't know we still need C rules so pretend like we have a C program |
---|
| 138 | .dummy_hack.c: |
---|
[28582b2] | 139 | @echo "int main() { return 0; }" > ${@} |
---|
| 140 | |
---|
[2b10f95] | 141 | .dummy_hackxx.cpp: |
---|
| 142 | @echo "int bar() { return 0; }" > ${@} |
---|
| 143 | |
---|
[026a0f5] | 144 | concurrency : |
---|
[a5121bf] | 145 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent |
---|
[026a0f5] | 146 | |
---|
[73abe95] | 147 | #---------------------------------------------------------------------------------------------------------------- |
---|
[dc8511c] | 148 | |
---|
[e16797c] | 149 | # Use for all tests, make sure the path are correct and all flags are added |
---|
[34e1494] | 150 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g')) |
---|
[d9b499c] | 151 | |
---|
[e16797c] | 152 | #---------------------------------------------------------------------------------------------------------------- |
---|
[a843067] | 153 | |
---|
[e16797c] | 154 | # implicit rule so not all test require a rule |
---|
[15f9c8e] | 155 | # split into two steps to support compiling remotely using distcc |
---|
[34e1494] | 156 | # don't use distcc to do the linking because distcc doesn't do linking |
---|
[d65f92c] | 157 | % : %.cfa $(CFACCBIN) |
---|
[b44959f] | 158 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o -DIN_DIR="$(abspath $(dir ${<}))/.in/" |
---|
[673eb7a] | 159 | $(CFACCLINK) ${@}.o -o $(abspath ${@}) |
---|
[468c5aa] | 160 | rm $(abspath ${@}).o |
---|
[f7d3215] | 161 | |
---|
[34e1494] | 162 | # implicit rule for c++ test |
---|
| 163 | # convient for testing the testsuite itself but not actuall used |
---|
[e16797c] | 164 | % : %.cpp |
---|
| 165 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) |
---|
[4c8f86b3] | 166 | |
---|
[f7d3215] | 167 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 168 | # TARGETS WITH CUSTOM FLAGS |
---|
[e16797c] | 169 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 170 | # custom libs |
---|
| 171 | gmp_FLAGSLD= -lgmp |
---|
[dc8511c] | 172 | |
---|
[e16797c] | 173 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 174 | # Generated code |
---|
| 175 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions |
---|
| 176 | $(GENERATED_CODE): % : %.cfa $(CFACCBIN) |
---|
| 177 | $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@}) |
---|
| 178 | |
---|
[e16797c] | 179 | #------------------------------------------------------------------------------ |
---|
| 180 | # CUSTOM TARGET |
---|
| 181 | #------------------------------------------------------------------------------ |
---|
[66812dd] | 182 | # tests that just validate syntax and compiler output should be compared to stderr |
---|
[e6cfb4e2] | 183 | CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@}) |
---|
[40c81e5] | 184 | |
---|
[35d1de5] | 185 | SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \ |
---|
[53692b3] | 186 | init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment |
---|
[66812dd] | 187 | $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 188 | $(CFACOMPILE_SYNTAX) |
---|
| 189 | $(if $(test), cp $(test) $(abspath ${@}), ) |
---|
[87fc1b4] | 190 | |
---|
[34e1494] | 191 | # expected failures |
---|
[e6cfb4e2] | 192 | # use custom target since they require a custom define *and* have a name that doesn't match the file |
---|
[34e1494] | 193 | alloc-ERROR : alloc.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 194 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 195 | -cp $(test) $(abspath ${@}) |
---|
[b93a3de] | 196 | |
---|
[ee858bf] | 197 | init1-ERROR : init1.cfa $(CFACCBIN) |
---|
| 198 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 199 | -cp $(test) $(abspath ${@}) |
---|
| 200 | |
---|
[34e1494] | 201 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 202 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 203 | -cp $(test) $(abspath ${@}) |
---|
[e2c70ab] | 204 | |
---|
[34e1494] | 205 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 206 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 207 | -cp $(test) $(abspath ${@}) |
---|
[49e1275] | 208 | |
---|
[34e1494] | 209 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 210 | $(CFACOMPILE_SYNTAX) -DERR2 |
---|
| 211 | -cp $(test) $(abspath ${@}) |
---|
[49e1275] | 212 | |
---|
[34e1494] | 213 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 214 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 215 | -cp $(test) $(abspath ${@}) |
---|
[cdbfab0] | 216 | |
---|
[34e1494] | 217 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 218 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 219 | -cp $(test) $(abspath ${@}) |
---|
[80e8582] | 220 | |
---|
[34e1494] | 221 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 222 | $(CFACOMPILE_SYNTAX) -DERR1 |
---|
| 223 | -cp $(test) $(abspath ${@}) |
---|
[80e8582] | 224 | |
---|
[34e1494] | 225 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
[e6cfb4e2] | 226 | $(CFACOMPILE_SYNTAX) -DERR2 |
---|
| 227 | -cp $(test) $(abspath ${@}) |
---|
[e16797c] | 228 | |
---|
[5715d43] | 229 | # Exception Tests |
---|
| 230 | # Test with libcfathread; it changes how storage works. |
---|
| 231 | |
---|
| 232 | exceptions/%-threads : exceptions/%.cfa $(CFACCBIN) |
---|
| 233 | $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o |
---|
| 234 | $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@}) |
---|
| 235 | |
---|
[673eb7a] | 236 | # Linking tests |
---|
| 237 | # Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls) |
---|
| 238 | linking/linkerror : linking/linkerror.cfa $(CFACCBIN) |
---|
| 239 | $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o |
---|
| 240 | $(CFACCLINK) -O0 ${@}.o -o $(abspath ${@}) |
---|
[a951171] | 241 | rm $(abspath ${@}).o |
---|
[673eb7a] | 242 | |
---|
[34e1494] | 243 | #------------------------------------------------------------------------------ |
---|
| 244 | # Other targets |
---|