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
This commit is contained in:
Jan Čermák 2025-04-25 14:39:01 +02:00 committed by GitHub
parent dbf7d46d5b
commit 9e8e9ce773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 <target>' 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 <target>-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'"