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>
subdirmk/generate

index f46747d..1787546 100755 (executable)
@@ -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))