blob: a6865a0fa2a21cdbee3175916a0f457c97422a44 [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})
Gyorgy Szingb73b5c22024-02-01 16:30:04 +000018RUN_SH_ARGS += -p "${FILTER_PATTERN}"
19endif
20
21ifneq (,${INSTALL_PREFIX})
22RUN_SH_ARGS += -i ${INSTALL_PREFIX}
23endif
24
25ifneq (,${BUILD_PREFIX})
26RUN_SH_ARGS += -b ${BUILD_PREFIX}
27endif
28
29ifneq (,${LOGDIR_ROOT})
30RUN_SH_ARGS += -l ${LOGDIR_ROOT}
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010031endif
32
Gyorgy Szingba1095c2020-11-24 00:33:11 +010033all:
Gyorgy Szingb164e392021-09-04 01:51:57 +020034 ${MAKE} config
Gyorgy Szingb73b5c22024-02-01 16:30:04 +000035 bash run.sh ${RUN_SH_ARGS}
Gyorgy Szingba1095c2020-11-24 00:33:11 +010036
37config: ${OUTPUTS}
38
39list:
Gyorgy Szingb164e392021-09-04 01:51:57 +020040 ${MAKE} config
Gyorgy Szingb73b5c22024-02-01 16:30:04 +000041 bash run.sh ${RUN_SH_ARGS} help
Gyorgy Szingba1095c2020-11-24 00:33:11 +010042
43# run a command of the generated script
44r-%:
Gyorgy Szingb164e392021-09-04 01:51:57 +020045 ${MAKE} config
Gyorgy Szingb73b5c22024-02-01 16:30:04 +000046 bash run.sh ${RUN_SH_ARGS} "$*"
Gyorgy Szingba1095c2020-11-24 00:33:11 +010047
48define help_msg
49*************************************************************
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010050Variables:
51 Variables can be passed as arguments (make <var>=<value>)
52 or be set in the environment (e.g. export <var>=<value>;
53 make ...).
54
Gyorgy Szingb73b5c22024-02-01 16:30:04 +000055 BUILD_PREFIX - Directory for build directories
Gyorgy Szingf24a03a2023-03-21 03:00:40 +010056 FILTER_PATTERN - grep regexp to limit test scope to tests
57 whose name matches. To see the selected tests
58 run: make FILTER_PATTERN=<pattern> list
Gyorgy Szingb73b5c22024-02-01 16:30:04 +000059 INSTALL_PREFIX - Directory to install projects
60 LOGDIR_ROOT - Directory to save build logs
61
Gyorgy Szingba1095c2020-11-24 00:33:11 +010062Available targets:
63 all - generate and run test script
64 config - run script generation only
65 clean - remove intermediate files
66 list - run config and list test cases
67 p-<variable> - print value of make variable (for debugging)
68 r-<test> - run a command of the generated script. Allow
69 executing a single test case. Use
70 make r-help
71 to get the list of tests.
72*************************************************************
73endef
74
75export help_msg
76help:
77 @echo "$$help_msg"
78
79# remove intermediate output
80clean:
81ifneq ($(wildcard ./run.sh),)
82 bash run.sh clean
83endif
84 -rm -rf ${OUTPUTS}
85
86# Convert template to shell script
87%.sh : %.sh.j2 test_data.yaml
88 yasha -v test_data.yaml $<
89
90# print variable value (i.e. make p-TEMPLATES)
91p-%:
92 @echo $*=${$*}