Message ID | 20240819160309.2218114-8-vegard.nossum@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | output a valid shell script when running 'make -n' | expand |
On Mon, Aug 19, 2024 at 06:03:04PM +0200, Vegard Nossum wrote: > Output 'make() { :; }' at the start of the script in order to make > all 'make' invocations in the resulting build script no-ops (GNU Make > will actually execute -- and print -- all recipe lines that include > $(MAKE), even when invoked with -n). > > Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> > --- > Makefile | 6 ++++++ > 1 file changed, 6 insertions(+) Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
diff --git a/Makefile b/Makefile index 953951157ec92..d08ade5791c2e 100644 --- a/Makefile +++ b/Makefile @@ -226,6 +226,12 @@ $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make # Invoke a second make in the output directory, passing relevant variables __sub-make: +ifdef dry_run + # define 'make' as a no-op alias so that those commands are not + # actually run + @make() { :; } + @export -f make +endif $(Q)$(MAKE) $(no-print-directory) -C $(abs_objtree) \ -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
Output 'make() { :; }' at the start of the script in order to make all 'make' invocations in the resulting build script no-ops (GNU Make will actually execute -- and print -- all recipe lines that include $(MAKE), even when invoked with -n). Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+)