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