From e637ec96e688439ca41a25fb09e11a958180ba75 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 24 Dec 2019 00:28:30 +0000 Subject: [PATCH] generate: Track output Makefiles properly This fixes a bug where the intermediate directory Makefile was not included whe it should be. Signed-off-by: Ian Jackson --- generate | 7 ++++--- tests/filter/main.mk.expected | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/generate b/generate index 14deda4..c17d5f7 100755 --- 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"; diff --git a/tests/filter/main.mk.expected b/tests/filter/main.mk.expected index 90073a2..ba72c96 100644 --- a/tests/filter/main.mk.expected +++ b/tests/filter/main.mk.expected @@ -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 -- 2.30.2