| 1 |
#! /usr/bin/make -rRf |
| 2 |
#? |
| 3 |
#? DESCRIPTION |
| 4 |
#? For more details please see |
| 5 |
#? ../Makefile Makefile Makefile.help Makefile.pod |
| 6 |
#? make help.test.TEMPL |
| 7 |
#? |
| 8 |
# HACKER's INFO |
| 9 |
# This file itself is not used (included) in t/Makefile. |
| 10 |
# |
| 11 |
#? VERSION |
| 12 |
#? @(#) Makefile.template 1.26 22/09/21 12:01:24 |
| 13 |
#? |
| 14 |
#? AUTHOR |
| 15 |
#? 18-may-18 Achim Hoffmann |
| 16 |
#? |
| 17 |
# ----------------------------------------------------------------------------- |
| 18 |
|
| 19 |
HELP-help.test.TEMPL = targets for testing SOMETHING |
| 20 |
# Makefile with template for new targets in Makefile.TEMPL |
| 21 |
|
| 22 |
_SID.TEMPL := 1.26 |
| 23 |
|
| 24 |
_MYSELF.TEMPL := t/Makefile.template |
| 25 |
# must be hardcoded because $(firstword $(MAKEFILE_LIST)) |
| 26 |
# gets the file of the initial call "make" command |
| 27 |
ALL.includes += $(_MYSELF.TEMPL) |
| 28 |
# add ourself to list of all included makefiles |
| 29 |
ALL.inc.type += TEMPL |
| 30 |
# add our type to list of all included types |
| 31 |
ALL.help.tests += help.test.TEMPL |
| 32 |
|
| 33 |
first-TEMPL-target-is-default: help.test.TEMPL |
| 34 |
# otherwise the first target from other included files would be used |
| 35 |
|
| 36 |
ifeq (,$(_SID.test)) |
| 37 |
-include t/Makefile |
| 38 |
# get general macros for testing from master makefile |
| 39 |
endif |
| 40 |
|
| 41 |
help.test.TEMPL: HELP_TYPE = TEMPL |
| 42 |
help.test.TEMPL-v: HELP_TYPE = TEMPL |
| 43 |
help.test.TEMPL-vv: HELP_TYPE = TEMPL |
| 44 |
|
| 45 |
#_____________________________________________________________________________ |
| 46 |
#________________________________________________________________ variables __| |
| 47 |
|
| 48 |
testcmd-TEMPL%: TEST.init = |
| 49 |
testcmd-TEMPL%: TEST.args = |
| 50 |
# TEST.init and TEST.args should be set for the targets herein |
| 51 |
# only, otherwise it may confuse other targets if this Makefile |
| 52 |
# is used together with other t/Makefile.* |
| 53 |
|
| 54 |
TEST.TEMPL.args = \ |
| 55 |
-TEMPL-opt \ |
| 56 |
|
| 57 |
ifdef TEST.hosts |
| 58 |
TEST.TEMPL.hosts= $(TEST.hosts) |
| 59 |
# list of TEST.hosts can be passed with environment or on command line |
| 60 |
endif |
| 61 |
# or |
| 62 |
TEST.TEMPL.hosts= host.to.be.tested |
| 63 |
# define our list of TEST.hosts |
| 64 |
|
| 65 |
#_____________________________________________________________________________ |
| 66 |
#_____________________________________________________ internal test target __| |
| 67 |
# just an internal info target |
| 68 |
test.TEMPL.internal: |
| 69 |
@echo "# TEST.file: $(TEST.file)" |
| 70 |
@echo "# TEST.TEMPL.hosts: $(TEST.TEMPL.hosts)" |
| 71 |
@echo "# ALL.testTEMPL: $(words $(ALL.testTEMPL)) : $(ALL.testTEMPL)" |
| 72 |
@echo "# ALL.test.TEMPL: $(words $(ALL.test.TEMPL)) : $(ALL.test.TEMPL)" |
| 73 |
@echo "# testcmd-TEMPL%: TEST.init = +quit" |
| 74 |
@echo "# -------------------------------------------------------------" |
| 75 |
|
| 76 |
.PHONY: test.TEMPL.internal |
| 77 |
|
| 78 |
#_____________________________________________________________________________ |
| 79 |
#______________________________________________________________ testing ... __| |
| 80 |
|
| 81 |
# Description for private help text. |
| 82 |
# SEE Make:variables and quotes |
| 83 |
# SEE Make:MAKE vs. MAKE_COMMAND |
| 84 |
|
| 85 |
HELP-_TEMPL1 = _____________________________________________ testing ... _ |
| 86 |
HELP-test.TEMPL = test functionality of SOMETHING |
| 87 |
HELP-test.TEMPL.log = same as test.TEMPL but store output in '$(TEST.logdir)/' |
| 88 |
|
| 89 |
HELP.TEMPL = $(_NL)\ |
| 90 |
\# Examples:$(_NL)\ |
| 91 |
\# $(MAKE_COMMAND)t.TEMPL |
| 92 |
|
| 93 |
HELP.test.TEMPL.all = # no special documentation yet |
| 94 |
|
| 95 |
# SEE Make:target name |
| 96 |
# SEE Make:target name prefix |
| 97 |
# SEE Make:target matching |
| 98 |
|
| 99 |
# There are two variants of defining unique targets in this Makefile. Only one |
| 100 |
# of them must be used: all from "Variant-1" or all from "Variant-2" ! |
| 101 |
|
| 102 |
## Variant-1 { |
| 103 |
# initialise variables for targets |
| 104 |
testcmd-TEMPL%: EXE.pl = ../program-for.TEMPL |
| 105 |
# program to perform the tests |
| 106 |
testcmd-TEMPL%: TEST.init = +quit |
| 107 |
# argument to be passed always to $(EXE.pl) |
| 108 |
|
| 109 |
# Set varables for each unique target. |
| 110 |
# NOTE: the % in the pattern rule will be used for the hostname later. |
| 111 |
testcmd-TEMPL001_%: TEST.args += +VERSION |
| 112 |
testcmd-TEMPL002_%: TEST.args += --help |
| 113 |
|
| 114 |
ALL.testTEMPL = $(shell awk -F% '($$1 ~ /^testcmd-TEMPL..._/){arr[$$1]=1}$(_EXE.print_arr_END.awk)' $(_MYSELF.TEMPL)) |
| 115 |
# dynamically generate list of all testcmd_TEMPLDDD targets |
| 116 |
|
| 117 |
## Variant-1 } |
| 118 |
|
| 119 |
|
| 120 |
## Variant-2 { |
| 121 |
testTEMPL-%: EXE.pl = ../program-for.TEMPL |
| 122 |
testTEMPL-%: TEST.init = +quit |
| 123 |
|
| 124 |
testTEMPL-001_%: TEST.args += +VERSION |
| 125 |
testTEMPL-002_%: TEST.args += --help |
| 126 |
|
| 127 |
ALL.testTEMPL = $(shell awk -F% '($$1 ~ /^testTEMPL-..._/){arr[$$1]=1}$(_EXE.print_arr_END.awk)' $(_MYSELF.TEMPL)) |
| 128 |
|
| 129 |
# pattern rule to map to testcmd-% |
| 130 |
testTEMPL-%: testcmd-% |
| 131 |
@$(EXE.dummy) |
| 132 |
|
| 133 |
## Variant-2 } |
| 134 |
|
| 135 |
ALL.test.TEMPL = $(foreach host,$(TEST.TEMPL.hosts),$(ALL.testTEMPL:%=%$(host))) |
| 136 |
ALL.test.TEMPL.log = $(ALL.test.TEMPL:%=%.log) |
| 137 |
# generate list of all targets |
| 138 |
|
| 139 |
#_____________________________________________________________________________ |
| 140 |
#______________________________________________________ targets for testing __| |
| 141 |
|
| 142 |
# more verbose target: test.TEMPL-v and test.TEMPL-vv |
| 143 |
test.TEMPL-%: test.TEMPL.internal test.TEMPL |
| 144 |
@$(EXE.dummy) |
| 145 |
|
| 146 |
test.TEMPL.log-compare: TEST.target_prefix = testcmd-TEMPL |
| 147 |
test.TEMPL.log-move: TEST.target_prefix = testcmd-TEMPL |
| 148 |
test.TEMPL.log: TEST.target_prefix = testcmd-TEMPL |
| 149 |
|
| 150 |
test.TEMPL: $(ALL.test.TEMPL) |
| 151 |
test.TEMPL.log: $(ALL.test.TEMPL.log) test.log-compare-hint |