Changeset e2887a9


Ignore:
Timestamp:
May 12, 2023, 6:51:41 PM (12 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
b3ce76f
Parents:
4dd10fb
Message:

add make-help option and change parenthesis to braces for variables

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r4dd10fb re2887a9  
    1111## Created On       : Sun May 31 22:14:18 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon May  1 16:38:04 2023
    14 ## Update Count     : 32
     13## Last Modified On : Fri May 12 18:30:01 2023
     14## Update Count     : 42
    1515###############################################################################
    16 
    17 # user targets:
    18 #  Compile compiler/runtime and run test suite.
    19 #  $ make check / tests [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
    20 
    21 #  $ make installcheck [debug=yes/no] installed=yes [arch=x86/x64/arm]
    2216
    2317AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
     
    3024DIST_SUBDIRS = driver src . libcfa tests
    3125
    32 @LIBCFA_TARGET_MAKEFILES@ : Makefile $(srcdir)/libcfa/configure
    33         @$(eval config_file = $(dir $@)config.data)
    34         @ls $(config_file) || (echo "Missing config.data, re-run configure script again" && false)
    35         @$(eval config_data = $(shell cat $(config_file)))
    36         @echo "Configuring libcfa ($(abs_top_srcdir)/libcfa/configure) with '$(config_data)' from $(shell pwd) / $(dir $@)"
    37         @cd $(dir $@) && $(abs_top_srcdir)/libcfa/configure $(config_data)
     26@LIBCFA_TARGET_MAKEFILES@ : Makefile ${srcdir}/libcfa/configure
     27        @${eval config_file = ${dir ${@}}config.data}
     28        @ls ${config_file} || (echo "Missing config.data, re-run configure script again" && false)
     29        @${eval config_data = ${shell cat ${config_file}}}
     30        @echo "Configuring libcfa (${abs_top_srcdir}/libcfa/configure) with '${config_data}' from ${shell pwd} / ${dir ${@}}"
     31        @cd ${dir ${@}} && ${abs_top_srcdir}/libcfa/configure ${config_data}
    3832
    3933noinst_DATA = @LIBCFA_TARGET_MAKEFILES@
     
    4539debug ?= yes
    4640installed ?= no
    47 ARCH = $(if $(arch),"arch=$(arch)")
     41ARCH = ${if ${arch},"arch=${arch}"}
    4842
    49 check:
    50         $(MAKE) -C tests tests installed=$(installed) debug=$(debug) $(ARCH)
     43check :
     44        ${MAKE} -C tests tests installed=${installed} debug=${debug} ${ARCH}
    5145
    52 tests: check # synonym
     46tests : check # synonym
    5347
    54 installcheck:
    55         $(MAKE) -C tests tests installed=yes debug=$(debug) $(ARCH)
     48installcheck :
     49        ${MAKE} -C tests tests installed=yes debug=${debug} ${ARCH}
    5650
    57 configure-libcfa: @LIBCFA_TARGET_MAKEFILES@
     51installtest : installcheck # synonym
     52
     53help :
     54        @echo "user targets:"
     55        @echo "    Compile compiler/runtime and run test suite."
     56        @echo "    $$ make check / tests [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]"
     57        @echo ""
     58        @echo "    Compile compiler/runtime, run test suite, and install."
     59        @echo "    $$ make installcheck / installtests [debug=yes/no] installed=yes [arch=x86/x64/arm]"
     60
     61configure-libcfa : @LIBCFA_TARGET_MAKEFILES@
    5862        @true
    5963
    60 status: @LIBCFA_TARGET_MAKEFILES@
     64status : @LIBCFA_TARGET_MAKEFILES@
    6165        @echo -ne "translator\n\t"
    6266        @./config.status --config | sed "s/ /\n\t/g; s/\t'/\t/g; s/'\n/\n/g; s/^'//g; s/'$$//g"
    6367        @find libcfa -name config.status -printf "\n%h\n\t" -exec {} --config \; | sed "s/ /\n\t/g; s/\t'/\t/g; s/'\n/\n/g; s/^'//g; s/'$$//g"
    6468
    65 @LIBCFA_TARGET_DIRS@::
    66         $(MAKE) -C $@ $(MAKECMDGOALS)
     69@LIBCFA_TARGET_DIRS@ ::
     70        ${MAKE} -C ${@} ${MAKECMDGOALS}
    6771
    68 mostlyclean clean distclean maintainer-clean: @LIBCFA_TARGET_DIRS@
     72mostlyclean clean distclean maintainer-clean : @LIBCFA_TARGET_DIRS@
  • tests/Makefile.am

    r4dd10fb re2887a9  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon May  1 17:25:24 2023
    14 ## Update Count     : 145
     13## Last Modified On : Fri May 12 18:03:57 2023
     14## Update Count     : 176
    1515###############################################################################
    16 
    17 # user targets:
    18 #  Run the complete test suite.
    19 #  $ make  / tests [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
    20 
    21 #  Run the short (quick) test suite.
    22 #  $ make quick [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
    2316
    2417AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
     
    2720include $(top_srcdir)/tools/build/cfa.make
    2821
    29 DEFAULT_INCLUDES = -I$(abs_srcdir)
     22DEFAULT_INCLUDES = -I${abs_srcdir}
    3023
    3124debug ?= yes
    3225installed ?= no
    33 ARCH=$(if $(arch),"--arch=$(arch)")
     26ARCH=${if ${arch},"--arch=${arch}"}
    3427archiveerrors=
    3528
     
    4134timeouts=
    4235
    43 TEST_PY = python3 $(builddir)/test.py
     36TEST_PY = python3 ${builddir}/test.py
    4437
    4538# applies to both programs
    4639# since automake doesn't have support for CFA we have to
    47 AM_CFLAGS = $(if $(test), 2> $(test), ) \
    48         -fdebug-prefix-map=$(abspath $(abs_srcdir))= \
     40AM_CFLAGS = ${if ${test}, 2> ${test}, } \
     41        -fdebug-prefix-map=${abspath ${abs_srcdir}}= \
    4942        -fdebug-prefix-map=/tmp= \
    5043        -fno-diagnostics-show-caret \
     
    5952
    6053# get the desired cfa to test
    61 TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
     54TARGET_CFA = ${if ${filter ${installed},yes}, @CFACC_INSTALL@, @CFACC@}
    6255
    6356# adjust CC to current flags
    64 CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) $(ARCH_FLAGS) ,$(TARGET_CFA) $(DEBUG_FLAGS) $(ARCH_FLAGS))
    65 CFACC = $(CC)
     57CC = LC_ALL=C ${if ${DISTCC_CFA_PATH},distcc ${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
     58CFACC = ${CC}
    6659
    6760# get local binary for depedencies
     
    6962
    7063# adjusted CC but without the actual distcc call
    71 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) $(ARCH_FLAGS) ,$(TARGET_CFA) $(DEBUG_FLAGS) $(ARCH_FLAGS))
    72 CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g'))
    73 
    74 PRETTY_PATH=mkdir -p $(dir $(abspath $(@))) && cd $(srcdir) &&
    75 
    76 .PHONY: list .validate .test_makeflags
    77 .INTERMEDIATE: .validate .validate.cfa .test_makeflags
     64CFACCLOCAL = ${if ${DISTCC_CFA_PATH},${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
     65CFACCLINK = ${CFACCLOCAL} -quiet ${if ${test}, 2> ${test}, } ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}}
     66
     67PRETTY_PATH=mkdir -p ${dir ${abspath ${@}}} && cd ${srcdir} &&
     68
     69.PHONY : list .validate .test_makeflags
     70.INTERMEDIATE : .validate .validate.cfa .test_makeflags
    7871EXTRA_PROGRAMS = avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install
    7972EXTRA_DIST = test.py \
     
    10194dist-hook:
    10295        echo "Gathering test files"
    103         for file in `$(TEST_PY) --list-dist`; do \
    104                 if test -f $(srcdir)/$${file}; then \
    105                         $(MKDIR_P) $$(dirname $(distdir)/$${file}); \
    106                         cp -df $(srcdir)/$${file} $(distdir)/$${file}; \
     96        for file in `${TEST_PY} --list-dist`; do \
     97                if test -f ${srcdir}/$${file}; then \
     98                        ${MKDIR_P} $$(dirname ${distdir}/$${file}); \
     99                        cp -df ${srcdir}/$${file} ${distdir}/$${file}; \
    107100                fi; \
    108101        done
    109 
    110102
    111103avl_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
     
    118110
    119111all-local : # This name is important to automake and implies the default build target.
    120         @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     112        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${ARCH} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    121113
    122114install : all-local # PAB only
     
    125117
    126118quick :
    127         @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) $(quick_test)
     119        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${ARCH} ${quick_test}
     120
     121concurrency :
     122        @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCH} -Iconcurrent
     123
     124list :
     125        @+${TEST_PY} --list ${concurrent}
     126
     127help :
     128        @echo "user targets:"
     129        @echo "    Run the complete test suite."
     130        @echo "    $$ make (null) / tests [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]"
     131        @echo ""
     132        @echo "    Run the short (quick) test suite."
     133        @echo "    $$ make quick [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]"
     134        @echo ""
     135        @echo "    Run the concurrent test suite."
     136        @echo "    $$ make concurrency [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]"
     137        @echo ""
     138        @echo "    List all tests in the test suite."
     139        @echo "    $$ make list"
    128140
    129141mostlyclean-local :
    130         find $(builddir) -not -path './__pycache__/*' -path '*.o' -delete
    131         find $(builddir) -not -path './__pycache__/*' -path '*/.err/*.log' -delete
    132         find $(builddir) -not -path './__pycache__/*' -path '*/.out/*.log' -delete
    133         rm -f $(EXTRA_PROGRAMS)
     142        find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
     143        find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
     144        find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
     145        rm -f ${EXTRA_PROGRAMS}
    134146        rm -rf __pycache__
    135147
    136148distclean-local :
    137         find $(builddir) -path '*.Po' -delete
    138 
    139 list :
    140         @+$(TEST_PY) --list $(concurrent)
     149        find ${builddir} -path '*.Po' -delete
    141150
    142151.test_makeflags:
    143         @echo "$(MAKEFLAGS)"
     152        @echo "${MAKEFLAGS}"
    144153
    145154.validate: .validate.cfa
    146         $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
     155        ${CFACOMPILE} .validate.cfa -fsyntax-only -Wall -Wextra -Werror
    147156
    148157.validate.cfa:
    149         @echo "int main() { return 0; }" > $(@)
     158        @echo "int main() { return 0; }" > ${@}
    150159
    151160# automake doesn't know we still need C rules so pretend like we have a C program
    152161.dummy_hack.c:
    153         @echo "int main() { return 0; }" > $(@)
     162        @echo "int main() { return 0; }" > ${@}
    154163
    155164.dummy_hackxx.cpp:
    156         @echo "int bar() { return 0; }" > $(@)
    157 
    158 concurrency :
    159         @+$(TEST_PY) --debug=$(debug)  --install=$(installed) -Iconcurrent
     165        @echo "int bar() { return 0; }" > ${@}
    160166
    161167#----------------------------------------------------------------------------------------------------------------
    162168
    163169# Use for all tests, make sure the path are correct and all flags are added
    164 CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) $($(shell echo "$(@)_FLAGSCFA" | sed 's/-\|\//_/g'))
     170CFACOMPILETEST=${PRETTY_PATH} ${CFACOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} ${${shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'}}
    165171
    166172#----------------------------------------------------------------------------------------------------------------
     
    169175# split into two steps to support compiling remotely using distcc
    170176# don't use distcc to do the linking because distcc doesn't do linking
    171 % : %.cfa $(CFACCBIN)
    172         $(CFACOMPILETEST) -c -o $(abspath $(@)).o -DIN_DIR="$(abspath $(dir $(<)))/.in/"
    173         $(CFACCLINK) $(@).o -o $(abspath $(@))
    174         rm $(abspath $(@)).o
     177% : %.cfa ${CFACCBIN}
     178        ${CFACOMPILETEST} -c -o ${abspath ${@}}.o -DIN_DIR="${abspath ${dir ${<}}}/.in/"
     179        ${CFACCLINK} ${@}.o -o ${abspath ${@}}
     180        rm ${abspath ${@}}.o
    175181
    176182# implicit rule for c++ test
    177183# convient for testing the testsuite itself but not actuall used
    178184% : %.cpp
    179         $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) -o $(abspath $(@))
     185        ${PRETTY_PATH} ${CXXCOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} -o ${abspath ${@}}
    180186
    181187#------------------------------------------------------------------------------
     
    188194# Generated code
    189195GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
    190 $(GENERATED_CODE): % : %.cfa $(CFACCBIN)
    191         $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath $(@))
     196${GENERATED_CODE} : % : %.cfa ${CFACCBIN}
     197        ${CFACOMPILETEST} -CFA -XCFA -p -c -fsyntax-only -o ${abspath ${@}}
    192198
    193199#------------------------------------------------------------------------------
     
    195201#------------------------------------------------------------------------------
    196202# tests that just validate syntax and compiler output should be compared to stderr
    197 CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath $(@))
     203CFACOMPILE_SYNTAX = ${CFACOMPILETEST} -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o ${abspath ${@}}
    198204
    199205SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
    200206        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
    201 $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
    202         $(CFACOMPILE_SYNTAX)
    203         $(if $(test), cp $(test) $(abspath $(@)), )
     207${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN}
     208        ${CFACOMPILE_SYNTAX}
     209        ${if ${test}, cp ${test} ${abspath ${@}}, }
    204210
    205211# expected failures
    206212# use custom target since they require a custom define *and* have a name that doesn't match the file
    207 alloc-ERROR : alloc.cfa $(CFACCBIN)
    208         $(CFACOMPILE_SYNTAX) -DERR1
    209         -cp $(test) $(abspath $(@))
    210 
    211 init1-ERROR : init1.cfa $(CFACCBIN)
    212         $(CFACOMPILE_SYNTAX) -DERR1
    213         -cp $(test) $(abspath $(@))
    214 
    215 typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
    216         $(CFACOMPILE_SYNTAX) -DERR1
    217         -cp $(test) $(abspath $(@))
    218 
    219 nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
    220         $(CFACOMPILE_SYNTAX) -DERR1
    221         -cp $(test) $(abspath $(@))
    222 
    223 nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
    224         $(CFACOMPILE_SYNTAX) -DERR2
    225         -cp $(test) $(abspath $(@))
    226 
    227 raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
    228         $(CFACOMPILE_SYNTAX) -DERR1
    229         -cp $(test) $(abspath $(@))
    230 
    231 raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
    232         $(CFACOMPILE_SYNTAX) -DERR1
    233         -cp $(test) $(abspath $(@))
    234 
    235 raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
    236         $(CFACOMPILE_SYNTAX) -DERR1
    237         -cp $(test) $(abspath $(@))
    238 
    239 raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
    240         $(CFACOMPILE_SYNTAX) -DERR2
    241         -cp $(test) $(abspath $(@))
     213alloc-ERROR : alloc.cfa ${CFACCBIN}
     214        ${CFACOMPILE_SYNTAX} -DERR1
     215        -cp ${test} ${abspath ${@}}
     216
     217init1-ERROR : init1.cfa ${CFACCBIN}
     218        ${CFACOMPILE_SYNTAX} -DERR1
     219        -cp ${test} ${abspath ${@}}
     220
     221typedefRedef-ERR1 : typedefRedef.cfa ${CFACCBIN}
     222        ${CFACOMPILE_SYNTAX} -DERR1
     223        -cp ${test} ${abspath ${@}}
     224
     225nested-types-ERR1 : nested-types.cfa ${CFACCBIN}
     226        ${CFACOMPILE_SYNTAX} -DERR1
     227        -cp ${test} ${abspath ${@}}
     228
     229nested-types-ERR2 : nested-types.cfa ${CFACCBIN}
     230        ${CFACOMPILE_SYNTAX} -DERR2
     231        -cp ${test} ${abspath ${@}}
     232
     233raii/memberCtors-ERR1 : raii/memberCtors.cfa ${CFACCBIN}
     234        ${CFACOMPILE_SYNTAX} -DERR1
     235        -cp ${test} ${abspath ${@}}
     236
     237raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa ${CFACCBIN}
     238        ${CFACOMPILE_SYNTAX} -DERR1
     239        -cp ${test} ${abspath ${@}}
     240
     241raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa ${CFACCBIN}
     242        ${CFACOMPILE_SYNTAX} -DERR1
     243        -cp ${test} ${abspath ${@}}
     244
     245raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa ${CFACCBIN}
     246        ${CFACOMPILE_SYNTAX} -DERR2
     247        -cp ${test} ${abspath ${@}}
    242248
    243249# Exception Tests
    244250# Test with libcfathread; it changes how storage works.
    245251
    246 exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
    247         $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath $(@)).o
    248         $(CFACCLOCAL) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath $(@)).o -o $(abspath $(@))
     252exceptions/%-threads : exceptions/%.cfa ${CFACCBIN}
     253        ${CFACOMPILETEST} -include exceptions/with-threads.hfa -c -o ${abspath ${@}}.o
     254        ${CFACCLOCAL} ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} ${abspath ${@}}.o -o ${abspath ${@}}
    249255
    250256# Linking tests
    251257# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
    252 linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
    253         $(CFACOMPILETEST) -O0 -c -o $(abspath $(@)).o
    254         $(CFACCLINK)  -O0 $(@).o -o $(abspath $(@))
    255         rm $(abspath $(@)).o
     258linking/linkerror : linking/linkerror.cfa ${CFACCBIN}
     259        ${CFACOMPILETEST} -O0 -c -o ${abspath ${@}}.o
     260        ${CFACCLINK}  -O0 ${@}.o -o ${abspath ${@}}
     261        rm ${abspath ${@}}.o
    256262
    257263#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.