Patchwork Makefile: Add missing rule for config-devices.mak

login
register
mail settings
Submitter Stefan Weil
Date Nov. 22, 2009, 2:07 p.m.
Message ID <1258898842-5222-1-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/38996/
State New
Headers show

Comments

Stefan Weil - Nov. 22, 2009, 2:07 p.m.
All files config-devices.mak are copies from files in
directory default-configs.

Creating these copies during configuration ignores these
dependencies and may result in unresolved externals
from incremental builds when files in default-configs
are modified.

By adding a dependency rule to Makefile and executing
the copy commands there it is possible to run incremental
builds even with modified default-configs.

This is especially useful for git bisect.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 Makefile  |    3 +++
 configure |    4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)
Scott Tsai - Nov. 22, 2009, 2:20 p.m.
On Sun, Nov 22, 2009 at 10:07 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> All files config-devices.mak are copies from files in
> directory default-configs.
>
> Creating these copies during configuration ignores these
> dependencies and may result in unresolved externals
> from incremental builds when files in default-configs
> are modified.
>
> By adding a dependency rule to Makefile and executing
> the copy commands there it is possible to run incremental
> builds even with modified default-configs.
>
> This is especially useful for git bisect.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  Makefile  |    3 +++
>  configure |    4 ----
>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d770e2a..fdb47fb 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -41,6 +41,9 @@ SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
>  config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
>        $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep "=y$$" | sort -u > $@,"  GEN   $@")
>
> +%/config-devices.mak: default-configs/%.mak
> +       $(call quiet-command,cp -p $< $@, "  GEN   $@")
> +
>  -include config-all-devices.mak
>
>  build-all: $(DOCS) $(TOOLS) recurse-all
> diff --git a/configure b/configure
> index b65c11c..1223fc8 100755
> --- a/configure
> +++ b/configure
> @@ -2209,10 +2209,6 @@ if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$targ
>   mkdir -p $target_dir/nwfpe
>  fi
>
> -if test ! -f $target_dir/config-devices.mak ; then
> -  cp $source_path/default-configs/${target}.mak $target_dir/config-devices.mak
> -fi
> -
>  #
>  # don't use ln -sf as not all "ln -sf" over write the file/link
>  #
> --
> 1.5.6.5

Acked-by Scott Tsai <scottt.tw@gmail.com>

I also hit this with the recent change to move two NICs into libhw and
build them for ARM targets.
Paul Brook - Nov. 23, 2009, 6:55 p.m.
On Sunday 22 November 2009, Stefan Weil wrote:
> All files config-devices.mak are copies from files in
> directory default-configs.


See commit a992fe3, specifically "make defconfig".

Paul
Stefan Weil - Nov. 26, 2009, 10:25 a.m.
Juan Quintela schrieb:
> Stefan Weil <weil@mail.berlios.de> wrote:
>> All files config-devices.mak are copies from files in
>> directory default-configs.
>>
>> Creating these copies during configuration ignores these
>> dependencies and may result in unresolved externals
>> from incremental builds when files in default-configs
>> are modified.
>>
>> By adding a dependency rule to Makefile and executing
>> the copy commands there it is possible to run incremental
>> builds even with modified default-configs.
>
> But then, if you have modified the file, you lost your changes.
> That file is not overwrote on purpose. Think of it as the .config when
> you compile your kernel. If you don't have one, it gets a default one.
> But if you have one, it will not overwrote it. Not all devices have
> been moved to the config file, but the idea is to move them there.
>
> Anthony, please don't apply.
>
> About the problem with bisect, if you start with the lastest version
> config file, it should just work (famous last words).
>
> Later, Juan.

What about overwriting it automatically when it was not modified
by the user? This would only need a backup copy of the original
default configuration. I assume that most users don't change
config-devices.mak, so they would be happy with this solution.
Calling "make defconfig" is only the second best solution for them.

A more sophisticated solution could try to create a patch from
original default configuration and user modified configuration.
Make could try to apply this patch to the new default configuration,
and if there is no conflict, all is fine as well.

Regards, Stefan
Paolo Bonzini - Nov. 26, 2009, 1:13 p.m.
> What about overwriting it automatically when it was not modified
> by the user? This would only need a backup copy of the original
> default configuration. I assume that most users don't change
> config-devices.mak, so they would be happy with this solution.
> Calling "make defconfig" is only the second best solution for them.
>
> A more sophisticated solution could try to create a patch from
> original default configuration and user modified configuration.
> Make could try to apply this patch to the new default configuration,
> and if there is no conflict, all is fine as well.

What about writing an include directive for the default config instead? 
  Then the user can add his overrides to the bottom of the include.

Paolo

Patch

diff --git a/Makefile b/Makefile
index d770e2a..fdb47fb 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,9 @@  SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
 	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep "=y$$" | sort -u > $@,"  GEN   $@")
 
+%/config-devices.mak: default-configs/%.mak
+	$(call quiet-command,cp -p $< $@, "  GEN   $@")
+
 -include config-all-devices.mak
 
 build-all: $(DOCS) $(TOOLS) recurse-all
diff --git a/configure b/configure
index b65c11c..1223fc8 100755
--- a/configure
+++ b/configure
@@ -2209,10 +2209,6 @@  if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$targ
   mkdir -p $target_dir/nwfpe
 fi
 
-if test ! -f $target_dir/config-devices.mak ; then
-  cp $source_path/default-configs/${target}.mak $target_dir/config-devices.mak
-fi
-
 #
 # don't use ln -sf as not all "ln -sf" over write the file/link
 #