]> Git Repo - buildroot-mgba.git/commitdiff
core: commonalise the bundled and br2-external %_defconfig rules
authorYann E. MORIN <[email protected]>
Sun, 17 Jul 2016 10:34:22 +0000 (12:34 +0200)
committerThomas Petazzoni <[email protected]>
Sat, 27 Aug 2016 14:08:52 +0000 (16:08 +0200)
The code for both cases is exactly the same, and only differs in the
location where defconfig files are looked for.

We use an intermediate macro to generate the corresponding rules,
because directly generating the rules is ugly and needs lots of escaping
and double-dollar-ing for the $(eval ...) and $(foreach ...) calls to
play nicely together.

Furthermore, that will be tremendously useful when we support multiple
br2-external trees.

Signed-off-by: "Yann E. MORIN" <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Peter Korsgaard <[email protected]>
Cc: Thomas De Schampheleire <[email protected]>
Cc: Arnout Vandecappelle <[email protected]>
Reviewed-by: Romain Naour <[email protected]>
[Thomas: move comment outside of the make target, so that it isn't
displayed on stdout when loading a defconfig.]
Signed-off-by: Thomas Petazzoni <[email protected]>
Makefile

index 9275c4d2cd11a12f9d2d781071b49d5715f022de..5ce520b0d567a00efe16bec4af39a8d511362eb6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -847,14 +847,13 @@ olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
        @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
 
+define percent_defconfig
 # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
-%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
-       @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(TOPDIR)/configs/$@ \
-               $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
-
-%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig outputmakefile
-       @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(BR2_EXTERNAL)/configs/$@ \
-               $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN)
+%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig outputmakefile
+       @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \
+               $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN)
+endef
+$(eval $(foreach d,$(TOPDIR) $(BR2_EXTERNAL),$(call percent_defconfig,$(d))$(sep)))
 
 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
        @$(COMMON_CONFIG_ENV) $< \
This page took 0.031539 seconds and 4 git commands to generate.