#! /usr/bin/make -rRf #? #? DESCRIPTION #? For more details please see #? ../Makefile Makefile Makefile.help Makefile.pod #? make help.test.TEMPL #? # HACKER's INFO # This file itself is not used (included) in t/Makefile. # #? VERSION #? @(#) Makefile.template 1.26 22/09/21 12:01:24 #? #? AUTHOR #? 18-may-18 Achim Hoffmann #? # ----------------------------------------------------------------------------- HELP-help.test.TEMPL = targets for testing SOMETHING # Makefile with template for new targets in Makefile.TEMPL _SID.TEMPL := 1.26 _MYSELF.TEMPL := t/Makefile.template # must be hardcoded because $(firstword $(MAKEFILE_LIST)) # gets the file of the initial call "make" command ALL.includes += $(_MYSELF.TEMPL) # add ourself to list of all included makefiles ALL.inc.type += TEMPL # add our type to list of all included types ALL.help.tests += help.test.TEMPL first-TEMPL-target-is-default: help.test.TEMPL # otherwise the first target from other included files would be used ifeq (,$(_SID.test)) -include t/Makefile # get general macros for testing from master makefile endif help.test.TEMPL: HELP_TYPE = TEMPL help.test.TEMPL-v: HELP_TYPE = TEMPL help.test.TEMPL-vv: HELP_TYPE = TEMPL #_____________________________________________________________________________ #________________________________________________________________ variables __| testcmd-TEMPL%: TEST.init = testcmd-TEMPL%: TEST.args = # TEST.init and TEST.args should be set for the targets herein # only, otherwise it may confuse other targets if this Makefile # is used together with other t/Makefile.* TEST.TEMPL.args = \ -TEMPL-opt \ ifdef TEST.hosts TEST.TEMPL.hosts= $(TEST.hosts) # list of TEST.hosts can be passed with environment or on command line endif # or TEST.TEMPL.hosts= host.to.be.tested # define our list of TEST.hosts #_____________________________________________________________________________ #_____________________________________________________ internal test target __| # just an internal info target test.TEMPL.internal: @echo "# TEST.file: $(TEST.file)" @echo "# TEST.TEMPL.hosts: $(TEST.TEMPL.hosts)" @echo "# ALL.testTEMPL: $(words $(ALL.testTEMPL)) : $(ALL.testTEMPL)" @echo "# ALL.test.TEMPL: $(words $(ALL.test.TEMPL)) : $(ALL.test.TEMPL)" @echo "# testcmd-TEMPL%: TEST.init = +quit" @echo "# -------------------------------------------------------------" .PHONY: test.TEMPL.internal #_____________________________________________________________________________ #______________________________________________________________ testing ... __| # Description for private help text. # SEE Make:variables and quotes # SEE Make:MAKE vs. MAKE_COMMAND HELP-_TEMPL1 = _____________________________________________ testing ... _ HELP-test.TEMPL = test functionality of SOMETHING HELP-test.TEMPL.log = same as test.TEMPL but store output in '$(TEST.logdir)/' HELP.TEMPL = $(_NL)\ \# Examples:$(_NL)\ \# $(MAKE_COMMAND)t.TEMPL HELP.test.TEMPL.all = # no special documentation yet # SEE Make:target name # SEE Make:target name prefix # SEE Make:target matching # There are two variants of defining unique targets in this Makefile. Only one # of them must be used: all from "Variant-1" or all from "Variant-2" ! ## Variant-1 { # initialise variables for targets testcmd-TEMPL%: EXE.pl = ../program-for.TEMPL # program to perform the tests testcmd-TEMPL%: TEST.init = +quit # argument to be passed always to $(EXE.pl) # Set varables for each unique target. # NOTE: the % in the pattern rule will be used for the hostname later. testcmd-TEMPL001_%: TEST.args += +VERSION testcmd-TEMPL002_%: TEST.args += --help ALL.testTEMPL = $(shell awk -F% '($$1 ~ /^testcmd-TEMPL..._/){arr[$$1]=1}$(_EXE.print_arr_END.awk)' $(_MYSELF.TEMPL)) # dynamically generate list of all testcmd_TEMPLDDD targets ## Variant-1 } ## Variant-2 { testTEMPL-%: EXE.pl = ../program-for.TEMPL testTEMPL-%: TEST.init = +quit testTEMPL-001_%: TEST.args += +VERSION testTEMPL-002_%: TEST.args += --help ALL.testTEMPL = $(shell awk -F% '($$1 ~ /^testTEMPL-..._/){arr[$$1]=1}$(_EXE.print_arr_END.awk)' $(_MYSELF.TEMPL)) # pattern rule to map to testcmd-% testTEMPL-%: testcmd-% @$(EXE.dummy) ## Variant-2 } ALL.test.TEMPL = $(foreach host,$(TEST.TEMPL.hosts),$(ALL.testTEMPL:%=%$(host))) ALL.test.TEMPL.log = $(ALL.test.TEMPL:%=%.log) # generate list of all targets #_____________________________________________________________________________ #______________________________________________________ targets for testing __| # more verbose target: test.TEMPL-v and test.TEMPL-vv test.TEMPL-%: test.TEMPL.internal test.TEMPL @$(EXE.dummy) test.TEMPL.log-compare: TEST.target_prefix = testcmd-TEMPL test.TEMPL.log-move: TEST.target_prefix = testcmd-TEMPL test.TEMPL.log: TEST.target_prefix = testcmd-TEMPL test.TEMPL: $(ALL.test.TEMPL) test.TEMPL.log: $(ALL.test.TEMPL.log) test.log-compare-hint