blob: 9a060b875a583d9c66e3c3add60ad07a390a3433 [file] [log] [blame]
Gyorgy Szingf24a03a2023-03-21 03:00:40 +01001# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
Gyorgy Szingba1095c2020-11-24 00:33:11 +01002#
3# SPDX-License-Identifier: BSD-3-Clause
4#
5
6.SUFFIXES:
7.SUFFIXES: .j2
8
9# Disable parallel execution for this makefile.
10.NOTPARALLEL:
11
12TEMPLATES:=$(wildcard *.j2)
13OUTPUTS:=$(TEMPLATES:%.j2=%)
14
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010015FILTER_PATTERN ?=
16
17ifneq (,${FILTER_PATTERN})
18FILTER_ARG=-p "${FILTER_PATTERN}"
19endif
20
Gyorgy Szingba1095c2020-11-24 00:33:11 +010021all:
Gyorgy Szingb164e392021-09-04 01:51:57 +020022 ${MAKE} config
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010023 bash run.sh ${FILTER_ARG}
Gyorgy Szingba1095c2020-11-24 00:33:11 +010024
25config: ${OUTPUTS}
26
27list:
Gyorgy Szingb164e392021-09-04 01:51:57 +020028 ${MAKE} config
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010029 bash run.sh ${FILTER_ARG} help
Gyorgy Szingba1095c2020-11-24 00:33:11 +010030
31# run a command of the generated script
32r-%:
Gyorgy Szingb164e392021-09-04 01:51:57 +020033 ${MAKE} config
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010034 bash run.sh ${FILTER_ARG} "$*"
Gyorgy Szingba1095c2020-11-24 00:33:11 +010035
36define help_msg
37*************************************************************
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010038Variables:
39 Variables can be passed as arguments (make <var>=<value>)
40 or be set in the environment (e.g. export <var>=<value>;
41 make ...).
42
43 FILTER_PATTERN - grep regexp to limit test scope to tests
44 whose name matches. To see the selected tests
45 run: make FILTER_PATTERN=<pattern> list
Gyorgy Szingba1095c2020-11-24 00:33:11 +010046Available targets:
47 all - generate and run test script
48 config - run script generation only
49 clean - remove intermediate files
50 list - run config and list test cases
51 p-<variable> - print value of make variable (for debugging)
52 r-<test> - run a command of the generated script. Allow
53 executing a single test case. Use
54 make r-help
55 to get the list of tests.
56*************************************************************
57endef
58
59export help_msg
60help:
61 @echo "$$help_msg"
62
63# remove intermediate output
64clean:
65ifneq ($(wildcard ./run.sh),)
66 bash run.sh clean
67endif
68 -rm -rf ${OUTPUTS}
69
70# Convert template to shell script
71%.sh : %.sh.j2 test_data.yaml
72 yasha -v test_data.yaml $<
73
74# print variable value (i.e. make p-TEMPLATES)
75p-%:
76 @echo $*=${$*}