chiark / gitweb /
subdirmk: break out subdirmk_target in generated Makefile
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 15:17:12 +0000 (15:17 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 15:49:34 +0000 (15:49 +0000)
We are going to want to reuse this.  Make it a simply-expanded make
variable rather than a perl variable, so that it only gets computed
once.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
generate

index 87e2214..22e8aff 100755 (executable)
--- a/generate
+++ b/generate
@@ -101,8 +101,9 @@ sub write_makefile ($$) {
 default: all
 \$(filter-out all,\$(MAKECMDGOALS)) all: run-main.mk
        \@:
+subdirmk_targets:=\$(or \$(MAKECMDGOALS),all)
 Makefile run-main.mk:
-       \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(or \$(MAKECMDGOALS),all))
+       \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(subdirmk_targets))
 .SUFFIXES:
 .PHONY:        run-main.mk
 END