chiark / gitweb /
generate: Track output Makefiles properly
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 24 Dec 2019 00:28:30 +0000 (00:28 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Dec 2019 22:19:08 +0000 (22:19 +0000)
This fixes a bug where the intermediate directory Makefile was not
included whe it should be.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
generate
tests/filter/main.mk.expected

index 14deda4e281dc35c42272019a76af253bec22b3e..c17d5f7d70e3ae848b84a6df77498108a4b6e1f0 100755 (executable)
--- a/generate
+++ b/generate
@@ -60,6 +60,7 @@ our $writing_output;
 our $buffering_output;
 our %output_files;
 our %input_files;
+our @output_makefiles;
 
 sub close_any_output_file() {
     return unless defined $writing_output;
@@ -233,6 +234,7 @@ sub process_subtree ($$) {
     my $dir_name = join '/', @$path ? @$path : '.';
     my $var_prefix = join '', map { "${_}_" } @$path ? @$path : qw(TOP);
 
+    push @output_makefiles, "${dir_prefix}Subdir.mk";
     write_makefile($dir_prefix, scalar @$path);
 
     my %targets = (all => []);
@@ -286,9 +288,8 @@ sub process_tree() {
     }
     o "SUBDIRMK_MAKEFILES :=\n";
     o "MAKEFILE_TEMPLATES :=\n";
-    o "SUBDIRMK_MAKEFILES += Subdir.mk\n";
-    foreach my $subdir (@subdirs) {
-       o "SUBDIRMK_MAKEFILES += $subdir/Subdir.mk\n";
+    foreach my $mf (@output_makefiles) {
+       o "SUBDIRMK_MAKEFILES += $mf\n";
     }
     foreach my $input (sort keys %input_files) {
        o "MAKEFILE_TEMPLATES += $input\n";
index 90073a2712a0deddcb8ea7feed95920985c10c74..ba72c96dcb7937c13ecf1b37f6a9a91d4c8cf175 100644 (file)
@@ -4,6 +4,7 @@ abs_top_srcdir=@abs_top_srcdir@
 SUBDIRMK_MAKEFILES :=
 MAKEFILE_TEMPLATES :=
 SUBDIRMK_MAKEFILES += Subdir.mk
+SUBDIRMK_MAKEFILES += sub/Subdir.mk
 SUBDIRMK_MAKEFILES += sub/dir/Subdir.mk
 MAKEFILE_TEMPLATES += ./Subdir.sd.mk
 MAKEFILE_TEMPLATES += ./sub/dir/Subdir.sd.mk