chiark / gitweb /
subdirmk: Fix bug when target in subdir exists
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Nov 2019 01:21:51 +0000 (01:21 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 24 Nov 2019 18:38:38 +0000 (18:38 +0000)
If you try to make a file that exists, the % rule doesn't seem to
match.  But providing the dependency for all of $(MAKCMDGOALS)
works.

We have to mention `all' explicitly because it might not appear in
$(MAKECMDGOALS).

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

index f46747da641acb3e0bb1847af7714fe548dceb19..178754614ea417bcf9e4d319482615f93dd55a5d 100755 (executable)
--- a/generate
+++ b/generate
@@ -99,7 +99,7 @@ sub write_makefile ($$) {
     my $cd = $depth ? join('/', ('..',) x $depth) : '.';
     o <<END;
 default: all
-%:     FORCE-ALWAYS-RUN
+\$(MAKECMDGOALS) all: FORCE-ALWAYS-RUN
        \@:
 Makefile FORCE-ALWAYS-RUN:
        \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(or \$(MAKECMDGOALS),all))