######################## -*- Mode: Makefile-Automake -*- ###################### ## ## Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo ## ## The contents of this file are covered under the licence agreement in the ## file "LICENCE" distributed with Cforall. ## ## Makefile.am -- ## ## Author : Peter A. Buhr ## Created On : Sun May 31 09:08:15 2015 ## Last Modified By : Peter A. Buhr ## Last Modified On : Tue Nov 20 11:18:51 2018 ## Update Count : 68 ############################################################################### AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names ACLOCAL_AMFLAGS = -I automake include $(top_srcdir)/src/cfa.make debug=yes installed=no archiveerrors= INSTALL_FLAGS=-in-tree DEBUG_FLAGS=-debug -O0 quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes concurrent= timeouts= TEST_PY = python3 ${builddir}/test.py # applies to both programs # since automake doesn't have support for CFA we have to AM_CFLAGS = $(if $(test), 2> $(test), ) \ -g \ -Wall \ -Wno-unused-function \ -quiet @CFA_FLAGS@ \ -DIN_DIR="${abs_srcdir}/.in/" CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}) CFACCBIN = @CFACC@ CFACC = $(CC) PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && .PHONY: list .validate .INTERMEDIATE: .validate .validate.cfa EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install 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 # automake doesn't know we still need C/CPP rules so pretend like we have a C program _dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp #---------------------------------------------------------------------------------------------------------------- all-local : @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} all-tests : @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program clean-local : rm -f ${EXTRA_PROGRAMS} list : @+${TEST_PY} --list ${concurrent} .validate: .validate.cfa $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror .validate.cfa: @echo "int main() { return 0; }" > ${@} # automake doesn't know we still need C rules so pretend like we have a C program .dummy_hack.c: @echo "int main() { return 0; }" > ${@} .dummy_hackxx.cpp: @echo "int bar() { return 0; }" > ${@} concurrency : @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent #---------------------------------------------------------------------------------------------------------------- # Use for all tests, make sure the path are correct and all flags are added CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) -c $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g')) # Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail CFATEST_STDOUT=$(CFACOMPILETEST) -o $(abspath ${@}) # Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr CFATEST_STDERR=$(CFACOMPILETEST) 2> $(abspath ${@}) #---------------------------------------------------------------------------------------------------------------- # implicit rule so not all test require a rule % : %.cfa $(CFACCBIN) $(CFACOMPILETEST) -o $(abspath ${@}).o $(CFACC) $(abspath ${@}).o -o $(abspath ${@}) % : %.cpp $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) #------------------------------------------------------------------------------ # TARGET WITH STANDARD RULE BUT CUSTOM FLAGS #------------------------------------------------------------------------------ # Expected failures declarationSpecifier_FLAGS= -CFA -XCFA -p gccExtensions_FLAGS= -CFA -XCFA -p extension_FLAGS= -CFA -XCFA -p attributes_FLAGS= -CFA -XCFA -p functions_FLAGS= -CFA -XCFA -p KRfunctions_FLAGS= -CFA -XCFA -p gmp_FLAGS= -lgmp #------------------------------------------------------------------------------ # Expected failures completeTypeError_FLAGS= -DERR1 #------------------------------------------------------------------------------ # CUSTOM TARGET #------------------------------------------------------------------------------ typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR1 alloc-ERROR: alloc.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR1 nested-types-ERR1: nested-types.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR1 nested-types-ERR2: nested-types.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR2 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR1 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR2 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR1 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN) $(CFATEST_STDOUT) -DERR1 #builtins builtins/sync: builtins/sync.cfa $(CFACCBIN) $(CFATEST_STDERR) -fsyntax-only # Warnings warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN) $(CFATEST_STDERR) -fsyntax-only