Gyorgy Szing | ba1095c | 2020-11-24 00:33:11 +0100 | [diff] [blame] | 1 | # Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. |
| 2 | # |
| 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 | |
| 12 | TEMPLATES:=$(wildcard *.j2) |
| 13 | OUTPUTS:=$(TEMPLATES:%.j2=%) |
| 14 | |
| 15 | all: |
Gyorgy Szing | b164e39 | 2021-09-04 01:51:57 +0200 | [diff] [blame] | 16 | ${MAKE} config |
Gyorgy Szing | ba1095c | 2020-11-24 00:33:11 +0100 | [diff] [blame] | 17 | bash run.sh |
| 18 | |
| 19 | config: ${OUTPUTS} |
| 20 | |
| 21 | list: |
Gyorgy Szing | b164e39 | 2021-09-04 01:51:57 +0200 | [diff] [blame] | 22 | ${MAKE} config |
Gyorgy Szing | ba1095c | 2020-11-24 00:33:11 +0100 | [diff] [blame] | 23 | bash run.sh help |
| 24 | |
| 25 | # run a command of the generated script |
| 26 | r-%: |
Gyorgy Szing | b164e39 | 2021-09-04 01:51:57 +0200 | [diff] [blame] | 27 | ${MAKE} config |
Gyorgy Szing | ba1095c | 2020-11-24 00:33:11 +0100 | [diff] [blame] | 28 | bash run.sh "$*" |
| 29 | |
| 30 | define help_msg |
| 31 | ************************************************************* |
| 32 | Available targets: |
| 33 | all - generate and run test script |
| 34 | config - run script generation only |
| 35 | clean - remove intermediate files |
| 36 | list - run config and list test cases |
| 37 | p-<variable> - print value of make variable (for debugging) |
| 38 | r-<test> - run a command of the generated script. Allow |
| 39 | executing a single test case. Use |
| 40 | make r-help |
| 41 | to get the list of tests. |
| 42 | ************************************************************* |
| 43 | endef |
| 44 | |
| 45 | export help_msg |
| 46 | help: |
| 47 | @echo "$$help_msg" |
| 48 | |
| 49 | # remove intermediate output |
| 50 | clean: |
| 51 | ifneq ($(wildcard ./run.sh),) |
| 52 | bash run.sh clean |
| 53 | endif |
| 54 | -rm -rf ${OUTPUTS} |
| 55 | |
| 56 | # Convert template to shell script |
| 57 | %.sh : %.sh.j2 test_data.yaml |
| 58 | yasha -v test_data.yaml $< |
| 59 | |
| 60 | # print variable value (i.e. make p-TEMPLATES) |
| 61 | p-%: |
| 62 | @echo $*=${$*} |