| 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
|
|---|
| 13 | ## Last Modified On : Tue Nov 20 11:18:51 2018
|
|---|
| 14 | ## Update Count : 68
|
|---|
| 15 | ###############################################################################
|
|---|
| 16 |
|
|---|
| 17 | AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names
|
|---|
| 18 | ACLOCAL_AMFLAGS = -I automake
|
|---|
| 19 |
|
|---|
| 20 | include $(top_srcdir)/tools/build/cfa.make
|
|---|
| 21 |
|
|---|
| 22 | DEFAULT_INCLUDES = -I${abs_srcdir}
|
|---|
| 23 |
|
|---|
| 24 | debug=yes
|
|---|
| 25 | installed=no
|
|---|
| 26 | archiveerrors=
|
|---|
| 27 |
|
|---|
| 28 | DEBUG_FLAGS=-debug -O0
|
|---|
| 29 |
|
|---|
| 30 | quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes
|
|---|
| 31 |
|
|---|
| 32 | concurrent=
|
|---|
| 33 | timeouts=
|
|---|
| 34 |
|
|---|
| 35 | TEST_PY = python3 ${builddir}/test.py
|
|---|
| 36 |
|
|---|
| 37 | # applies to both programs
|
|---|
| 38 | # since automake doesn't have support for CFA we have to
|
|---|
| 39 | AM_CFLAGS = $(if $(test), 2> $(test), ) \
|
|---|
| 40 | -fdebug-prefix-map=$(abspath ${abs_srcdir})= \
|
|---|
| 41 | -fdebug-prefix-map=/tmp= \
|
|---|
| 42 | -g \
|
|---|
| 43 | -Wall \
|
|---|
| 44 | -Wno-unused-function \
|
|---|
| 45 | -quiet @CFA_FLAGS@ \
|
|---|
| 46 | -DIN_DIR="${abs_srcdir}/.in/"
|
|---|
| 47 |
|
|---|
| 48 | AM_CFAFLAGS = -XCFA --deterministic-out
|
|---|
| 49 |
|
|---|
| 50 | # get the desired cfa to test
|
|---|
| 51 | TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
|
|---|
| 52 |
|
|---|
| 53 | # adjust CC to current flags
|
|---|
| 54 | CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
|
|---|
| 55 | CFACC = $(CC)
|
|---|
| 56 |
|
|---|
| 57 | # get local binary for depedencies
|
|---|
| 58 | CFACCBIN = @CFACC@
|
|---|
| 59 |
|
|---|
| 60 | # adjusted CC but without the actual distcc call
|
|---|
| 61 | CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
|
|---|
| 62 |
|
|---|
| 63 | PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
|
|---|
| 64 |
|
|---|
| 65 | .PHONY: list .validate
|
|---|
| 66 | .INTERMEDIATE: .validate .validate.cfa
|
|---|
| 67 | EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
|
|---|
| 68 |
|
|---|
| 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
|
|---|
| 70 | # automake doesn't know we still need C/CPP rules so pretend like we have a C program
|
|---|
| 71 | nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
|
|---|
| 72 |
|
|---|
| 73 | #----------------------------------------------------------------------------------------------------------------
|
|---|
| 74 | all-local :
|
|---|
| 75 | @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
|
|---|
| 76 |
|
|---|
| 77 | all-tests :
|
|---|
| 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
|
|---|
| 79 |
|
|---|
| 80 | clean-local :
|
|---|
| 81 | rm -f ${EXTRA_PROGRAMS}
|
|---|
| 82 |
|
|---|
| 83 | list :
|
|---|
| 84 | @+${TEST_PY} --list ${concurrent}
|
|---|
| 85 |
|
|---|
| 86 | .validate: .validate.cfa
|
|---|
| 87 | $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
|
|---|
| 88 |
|
|---|
| 89 | .validate.cfa:
|
|---|
| 90 | @echo "int main() { return 0; }" > ${@}
|
|---|
| 91 |
|
|---|
| 92 | # automake doesn't know we still need C rules so pretend like we have a C program
|
|---|
| 93 | .dummy_hack.c:
|
|---|
| 94 | @echo "int main() { return 0; }" > ${@}
|
|---|
| 95 |
|
|---|
| 96 | .dummy_hackxx.cpp:
|
|---|
| 97 | @echo "int bar() { return 0; }" > ${@}
|
|---|
| 98 |
|
|---|
| 99 | concurrency :
|
|---|
| 100 | @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent
|
|---|
| 101 |
|
|---|
| 102 | #----------------------------------------------------------------------------------------------------------------
|
|---|
| 103 |
|
|---|
| 104 | # Use for all tests, make sure the path are correct and all flags are added
|
|---|
| 105 | CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
|
|---|
| 106 |
|
|---|
| 107 | #----------------------------------------------------------------------------------------------------------------
|
|---|
| 108 |
|
|---|
| 109 | # implicit rule so not all test require a rule
|
|---|
| 110 | # split into two steps to support compiling remotely using distcc
|
|---|
| 111 | # don't use distcc to do the linking because distcc doesn't do linking
|
|---|
| 112 | % : %.cfa $(CFACCBIN)
|
|---|
| 113 | $(CFACOMPILETEST) -c -o $(abspath ${@}).o
|
|---|
| 114 | $(CFACCLOCAL) $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) ${@}.o -o $(abspath ${@})
|
|---|
| 115 |
|
|---|
| 116 | # implicit rule for c++ test
|
|---|
| 117 | # convient for testing the testsuite itself but not actuall used
|
|---|
| 118 | % : %.cpp
|
|---|
| 119 | $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
|
|---|
| 120 |
|
|---|
| 121 | #------------------------------------------------------------------------------
|
|---|
| 122 | # TARGETS WITH CUSTOM FLAGS
|
|---|
| 123 | #------------------------------------------------------------------------------
|
|---|
| 124 | # custom libs
|
|---|
| 125 | gmp_FLAGSLD= -lgmp
|
|---|
| 126 |
|
|---|
| 127 | #------------------------------------------------------------------------------
|
|---|
| 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 ${@})
|
|---|
| 137 |
|
|---|
| 138 | #------------------------------------------------------------------------------
|
|---|
| 139 | # CUSTOM TARGET
|
|---|
| 140 | #------------------------------------------------------------------------------
|
|---|
| 141 | # tests that just validate syntax
|
|---|
| 142 | expression : expression.cfa $(CFACCBIN)
|
|---|
| 143 | $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
|
|---|
| 144 |
|
|---|
| 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 ${@})
|
|---|
| 149 |
|
|---|
| 150 | typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
|
|---|
| 151 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 152 |
|
|---|
| 153 | nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
|
|---|
| 154 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 155 |
|
|---|
| 156 | nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
|
|---|
| 157 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 158 |
|
|---|
| 159 | raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
|
|---|
| 160 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 161 |
|
|---|
| 162 | raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
|
|---|
| 163 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 164 |
|
|---|
| 165 | raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
|
|---|
| 166 | $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 167 |
|
|---|
| 168 | raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
|
|---|
| 169 | $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
|
|---|
| 170 |
|
|---|
| 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 |
|
|---|
| 178 | #------------------------------------------------------------------------------
|
|---|
| 179 | # Other targets
|
|---|