chiark
/
gitweb
/
~ian
/
subdirmk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
generate: Add missing final newline to main.mk
[subdirmk.git]
/
generate
diff --git
a/generate
b/generate
index f46747da641acb3e0bb1847af7714fe548dceb19..fe3e3f5866674bcf17fa69ea6addaba1225cb3bb 100755
(executable)
--- a/
generate
+++ b/
generate
@@
-97,14
+97,18
@@
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
o <<END;
default: all
-%: FORCE-ALWAYS-RUN
+\$(filter-out all,\$(MAKECMDGOALS)) all: run-main.mk
\@:
\@:
-Makefile FORCE-ALWAYS-RUN:
- \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(or \$(MAKECMDGOALS),all))
+subdirmk_targets:=\$(or \$(MAKECMDGOALS),all)
+Makefile run-main.mk:
+ \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(subdirmk_targets))$suppress_templates
.SUFFIXES:
.SUFFIXES:
-.PHONY:
FORCE-ALWAYS-RUN
+.PHONY:
run-main.mk
END
}
END
}
@@
-254,6
+258,11
@@
sub process_subtree ($$) {
}
print O "\n";
}
}
print O "\n";
}
+ if (@targets) {
+ print O ".PHONY:";
+ print O " ${dir_prefix}${_}" foreach @targets;
+ print O "\n";
+ }
return @targets;
}
return @targets;
}
@@
-273,7
+282,7
@@
sub process_tree() {
foreach my $input (sort keys %input_files) {
o "MAKEFILE_TEMPLATES += $input\n";
}
foreach my $input (sort keys %input_files) {
o "MAKEFILE_TEMPLATES += $input\n";
}
- o "include \$(SUBDIRMK_MAKEFILES)";
+ o "include \$(SUBDIRMK_MAKEFILES)
\n
";
}
build_tree();
}
build_tree();