summaryrefslogtreecommitdiff
path: root/wrapper/runcmd.mk
blob: cdfa897c8b52cc13903d5fbae22f52ab6efd9492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/make -f
# Environment/command line variables:
# - ARGS
# - EXEC_DIR
# - CWD

MAKEFLAGS += --no-builtin-rules
SHELL = bash -o pipefail

export OUTPUT_DIR := $(realpath .)

$(MAKECMDGOALS): % : $(EXEC_PATH)/modules/%
	mkdir -p -- '$(@D)'
	(cd $(CWD) && '$<' $(ARGS)) | tee -- '$@' | sed 's,^,$@:,' >&2

include $(wildcard $(EXEC_PATH)/modules/*.mk)