[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}) |
---|
[34e1494] | 62 | |
---|
[e16797c] | 63 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && |
---|
[f7d3215] | 64 | |
---|
[28582b2] | 65 | .PHONY: list .validate |
---|
[1e995d6] | 66 | .INTERMEDIATE: .validate .validate.cfa |
---|
[107b01a] | 67 | EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install |
---|
[44f44617] | 68 | |
---|
[107b01a] | 69 | 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] | 70 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program |
---|
[b7fe2e6] | 71 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp |
---|
[a0dcd2e] | 72 | |
---|
[73abe95] | 73 | #---------------------------------------------------------------------------------------------------------------- |
---|
[927e9ce] | 74 | all-local : |
---|
[5c4a473] | 75 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} |
---|
[df42128] | 76 | |
---|
| 77 | all-tests : |
---|
[5c4a473] | 78 | @+${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] | 79 | |
---|
| 80 | clean-local : |
---|
[a6dd5b0] | 81 | rm -f ${EXTRA_PROGRAMS} |
---|
[927e9ce] | 82 | |
---|
| 83 | list : |
---|
[f85bc15] | 84 | @+${TEST_PY} --list ${concurrent} |
---|
[927e9ce] | 85 | |
---|
[1e995d6] | 86 | .validate: .validate.cfa |
---|
| 87 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror |
---|
| 88 | |
---|
| 89 | .validate.cfa: |
---|
| 90 | @echo "int main() { return 0; }" > ${@} |
---|
[28582b2] | 91 | |
---|
[107b01a] | 92 | # automake doesn't know we still need C rules so pretend like we have a C program |
---|
| 93 | .dummy_hack.c: |
---|
[28582b2] | 94 | @echo "int main() { return 0; }" > ${@} |
---|
| 95 | |
---|
[2b10f95] | 96 | .dummy_hackxx.cpp: |
---|
| 97 | @echo "int bar() { return 0; }" > ${@} |
---|
| 98 | |
---|
[026a0f5] | 99 | concurrency : |
---|
[a5121bf] | 100 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent |
---|
[026a0f5] | 101 | |
---|
[73abe95] | 102 | #---------------------------------------------------------------------------------------------------------------- |
---|
[dc8511c] | 103 | |
---|
[e16797c] | 104 | # Use for all tests, make sure the path are correct and all flags are added |
---|
[34e1494] | 105 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g')) |
---|
[d9b499c] | 106 | |
---|
[e16797c] | 107 | #---------------------------------------------------------------------------------------------------------------- |
---|
[a843067] | 108 | |
---|
[e16797c] | 109 | # implicit rule so not all test require a rule |
---|
[15f9c8e] | 110 | # split into two steps to support compiling remotely using distcc |
---|
[34e1494] | 111 | # don't use distcc to do the linking because distcc doesn't do linking |
---|
[d65f92c] | 112 | % : %.cfa $(CFACCBIN) |
---|
[7009b9b] | 113 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o |
---|
[87fc1b4] | 114 | $(CFACCLOCAL) $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) ${@}.o -o $(abspath ${@}) |
---|
[f7d3215] | 115 | |
---|
[34e1494] | 116 | # implicit rule for c++ test |
---|
| 117 | # convient for testing the testsuite itself but not actuall used |
---|
[e16797c] | 118 | % : %.cpp |
---|
| 119 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) |
---|
[4c8f86b3] | 120 | |
---|
[f7d3215] | 121 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 122 | # TARGETS WITH CUSTOM FLAGS |
---|
[e16797c] | 123 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 124 | # custom libs |
---|
| 125 | gmp_FLAGSLD= -lgmp |
---|
[dc8511c] | 126 | |
---|
[e16797c] | 127 | #------------------------------------------------------------------------------ |
---|
[34e1494] | 128 | # Generated code |
---|
| 129 | GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions |
---|
| 130 | $(GENERATED_CODE): % : %.cfa $(CFACCBIN) |
---|
| 131 | $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@}) |
---|
| 132 | |
---|
| 133 | # Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr |
---|
| 134 | EXPECT_STDERR = builtins/sync warnings/self-assignment |
---|
| 135 | $(EXPECT_STDERR): % : %.cfa $(CFACCBIN) |
---|
| 136 | $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@}) |
---|
[486341f] | 137 | |
---|
[e16797c] | 138 | #------------------------------------------------------------------------------ |
---|
| 139 | # CUSTOM TARGET |
---|
| 140 | #------------------------------------------------------------------------------ |
---|
[87fc1b4] | 141 | # tests that just validate syntax |
---|
| 142 | expression : expression.cfa $(CFACCBIN) |
---|
| 143 | $(CFACOMPILETEST) -c -fsyntax-only -o $(abspath ${@}) |
---|
| 144 | |
---|
[34e1494] | 145 | # expected failures |
---|
| 146 | # use custom target since they require a custom define and custom dependencies |
---|
| 147 | alloc-ERROR : alloc.cfa $(CFACCBIN) |
---|
| 148 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) |
---|
[b93a3de] | 149 | |
---|
[34e1494] | 150 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN) |
---|
| 151 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) |
---|
[e2c70ab] | 152 | |
---|
[34e1494] | 153 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN) |
---|
| 154 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) |
---|
[49e1275] | 155 | |
---|
[34e1494] | 156 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN) |
---|
| 157 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@}) |
---|
[49e1275] | 158 | |
---|
[34e1494] | 159 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN) |
---|
| 160 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) |
---|
[cdbfab0] | 161 | |
---|
[34e1494] | 162 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN) |
---|
| 163 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) |
---|
[80e8582] | 164 | |
---|
[34e1494] | 165 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
| 166 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) |
---|
[80e8582] | 167 | |
---|
[34e1494] | 168 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN) |
---|
| 169 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@}) |
---|
[e16797c] | 170 | |
---|
[5715d43] | 171 | # Exception Tests |
---|
| 172 | # Test with libcfathread; it changes how storage works. |
---|
| 173 | |
---|
| 174 | exceptions/%-threads : exceptions/%.cfa $(CFACCBIN) |
---|
| 175 | $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o |
---|
| 176 | $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@}) |
---|
| 177 | |
---|
[34e1494] | 178 | #------------------------------------------------------------------------------ |
---|
| 179 | # Other targets |
---|