From mboxrd@z Thu Jan 1 00:00:00 1970 From: Romain Naour Date: Sat, 30 Jul 2016 22:48:56 +0200 Subject: [Buildroot] [PATCH 02/16 v3] core: commonalise the bundled and br2-external %_defconfig rules In-Reply-To: References: Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net Hi Yann, All, Le 17/07/2016 ? 12:34, Yann E. MORIN a ?crit : > 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. This patch is similar to the one sent by Sam Bobroff [1]. I reviewed it during the summer camp but it was not applied since it was in a series we rejected. Reviewed-by: Romain Naour Best regards, Romain [1] http://lists.busybox.net/pipermail/buildroot/2016-June/165382.html > > Signed-off-by: "Yann E. MORIN" > Cc: Thomas Petazzoni > Cc: Peter Korsgaard > Cc: Thomas De Schampheleire > Cc: Arnout Vandecappelle > > --- > Changes v2 -> v3: > - use lower-case macro (Arnout) > - move comment in the generated rule (Arnout) > --- > Makefile | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/Makefile b/Makefile > index af2d982..7c0dcb1 100644 > --- 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) > > -# 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) > +define percent_defconfig > +%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig outputmakefile > + # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig > + @$$(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) $< \ >