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>
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))