From 9e8e9ce773b852927c54e18335d75863d4ee62c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Fri, 25 Apr 2025 14:39:01 +0200 Subject: [PATCH] Fall back to buildroot make in top-level make (#4039) * Fall back to buildroot make in top-level make To make running Buildroot commands easier, define .DEFAULT rule and fall back to targets from Buildroot with necessary variables set. This makes "savedefconfig" redundant as it's been simply passed to BR. * Also implicitly fall back to 'clean' target * Fix typo --- Makefile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 8facde86d..07cca59d2 100644 --- a/Makefile +++ b/Makefile @@ -16,14 +16,10 @@ endif .NOTPARALLEL: $(TARGETS) $(TARGETS_CONFIG) all -.PHONY: $(TARGETS) $(TARGETS_CONFIG) all clean help +.PHONY: $(TARGETS) $(TARGETS_CONFIG) all buildroot-help help all: $(TARGETS) -savedefconfig: - @echo "config $*" - $(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "savedefconfig" - $(TARGETS_CONFIG): %-config: @echo "config $*" $(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$*_defconfig" @@ -39,12 +35,18 @@ ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1) endif @echo "finished $@" -clean: - $(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) clean +.DEFAULT: + @echo "falling back to Buildroot target '$@'" + $(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$@" + +buildroot-help: + $(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) help help: - @echo "Supported targets: $(TARGETS)" @echo "Run 'make ' to build a target image." @echo "Run 'make all' to build all target images." - @echo "Run 'make clean' to clean the build output." @echo "Run 'make -config' to configure buildroot for a target." + @echo "" + @echo "Supported targets: $(TARGETS)" + @echo "" + @echo "Unknown Makefile targets fall back to Buildroot make - for details run 'make buildroot-help'"