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 <[email protected]>
---
 Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

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)
 
-- 
2.34.1


Reply via email to