chiark / gitweb /
subdirmk: Suppress MAKEFILE_TEMPLATES when running `make clean'
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 15:28:29 +0000 (15:28 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 15:49:34 +0000 (15:49 +0000)
See the README hunk for the reasoning.

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

diff --git a/README b/README
index 518dd087d853308b13e07aab805349714288d26e..27dd8556a77c05ecd047b7aaa5aa23c3a7f2957e 100644 (file)
--- a/README
+++ b/README
@@ -371,6 +371,13 @@ makefiles, you may find that just `make' is broken now and cannot get
 far enough to regenerate a working set of makefiles.  If this happens
 just rerun ./config.status by hand.
 
 far enough to regenerate a working set of makefiles.  If this happens
 just rerun ./config.status by hand.
 
+If you go back and forth between different versions of your code you
+can sometimes find that `make' complains that one of your Subdir.sd.mk
+files is missing: typically, if iot was used and therefore a
+dependency in some other version of your code.  If you run `make
+clean' (or `make realclean') these dependencies are suppressed, which
+will clear up the problem.
+
 
 Legal information
 -----------------
 
 Legal information
 -----------------
index 22e8aff57e36abf60d977acebd89ddeebaa91236..32c6fbf61a7ba1ffcd48f9b79402f6951ddfd6e5 100755 (executable)
--- a/generate
+++ b/generate
@@ -97,13 +97,16 @@ sub write_makefile ($$) {
     #print STDERR "write_makefile @_\n";
     start_output_file("${dir_prefix}Makefile");
     my $cd = $depth ? join('/', ('..',) x $depth) : '.';
     #print STDERR "write_makefile @_\n";
     start_output_file("${dir_prefix}Makefile");
     my $cd = $depth ? join('/', ('..',) x $depth) : '.';
+    my $suppress_templates=
+       '$(if $(filter-out clean real-clean, $(subdirmk_targets)),,'.
+       ' MAKEFILE_TEMPLATES=)';
     o <<END;
 default: all
 \$(filter-out all,\$(MAKECMDGOALS)) all: run-main.mk
        \@:
 subdirmk_targets:=\$(or \$(MAKECMDGOALS),all)
 Makefile run-main.mk:
     o <<END;
 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},\$(subdirmk_targets))
+       \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(subdirmk_targets))$suppress_templates
 .SUFFIXES:
 .PHONY:        run-main.mk
 END
 .SUFFIXES:
 .PHONY:        run-main.mk
 END