Patchwork Makefile: defconfig: use BR2_DEFCONFIG only when the file exists

login
register
mail settings
Submitter Fabio Porcedda
Date May 30, 2013, 1:57 p.m.
Message ID <1369922260-8237-1-git-send-email-fabio.porcedda@gmail.com>
Download mbox | patch
Permalink /patch/247610/
State Superseded
Headers show

Comments

Fabio Porcedda - May 30, 2013, 1:57 p.m.
This is to be able to use "make defconfig" even when BR2_DEFCONFIG has
a filename that does not exist or use the default value that
does not exists.

Example on a clean installation, without a "./defconfig":
   make defconfig
   make defconfig

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Thomas Petazzoni - May 30, 2013, 2:01 p.m.
Dear Fabio Porcedda,

On Thu, 30 May 2013 15:57:40 +0200, Fabio Porcedda wrote:
> This is to be able to use "make defconfig" even when BR2_DEFCONFIG has
> a filename that does not exist or use the default value that
> does not exists.
> 
> Example on a clean installation, without a "./defconfig":
>    make defconfig
>    make defconfig

I'm not sure to understand the example here. Could you detail a little
bit?

Thomas
Fabio Porcedda - May 30, 2013, 2:25 p.m.
On Thu, May 30, 2013 at 4:01 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Fabio Porcedda,
>
> On Thu, 30 May 2013 15:57:40 +0200, Fabio Porcedda wrote:
>> This is to be able to use "make defconfig" even when BR2_DEFCONFIG has
>> a filename that does not exist or use the default value that
>> does not exists.
>>
>> Example on a clean installation, without a "./defconfig":
>>    make defconfig
>>    make defconfig
>
> I'm not sure to understand the example here. Could you detail a little
> bit?

Without this patch the first "make defconfig" works, but the second
"make defconfig" fails.
With this patch the second "make defconfig" works like the first one.

This is because when the first "make defconfig" is issued the
BR2_DEFCONFIG is empty, instead when the second "make defconfig" is
issued the BR2_DEFCONFIG has the default value
"$(CONFIG_DIR)/defconfig" that usually does not exists and so fails.

I fixed this failure ignoring the BR2_DEFCONFIG when the default value
does not exist.

Best regards
--
Fabio Porcedda
Yann E. MORIN - Dec. 26, 2013, 11:09 p.m.
Fabio, Thomas, All,

On 2013-05-30 16:25 +0200, Fabio Porcedda spake thusly:
> On Thu, May 30, 2013 at 4:01 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
> > Dear Fabio Porcedda,
> >
> > On Thu, 30 May 2013 15:57:40 +0200, Fabio Porcedda wrote:
> >> This is to be able to use "make defconfig" even when BR2_DEFCONFIG has
> >> a filename that does not exist or use the default value that
> >> does not exists.
> >>
> >> Example on a clean installation, without a "./defconfig":
> >>    make defconfig
> >>    make defconfig
> >
> > I'm not sure to understand the example here. Could you detail a little
> > bit?
> 
> Without this patch the first "make defconfig" works, but the second
> "make defconfig" fails.
> With this patch the second "make defconfig" works like the first one.

I think I have a better fix for this:
    http://patchwork.ozlabs.org/patch/305312/

So I'm marking your patch as superseded.

Regards,
Yann E. MORIN.

Patch

diff --git a/Makefile b/Makefile
index e8647d1..57bf8b3 100644
--- a/Makefile
+++ b/Makefile
@@ -698,7 +698,7 @@  olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 
 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) $< --defconfig$(if $(wildcard $(DEFCONFIG)),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
 
 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config