Re: [U-Boot] [PATCH 4/4 v2] Makefile/mkconfig: read simple board configurations from boards.cfg

2010-06-13 Thread Wolfgang Denk
In message 1274995116-8708-5-git-send-email...@denx.de you wrote:
 Instead of adding explicit build rules for each and every board to the
 top level Makefile (which makes it grow and grow), we now provide a
 simple default rule and extend the mkconfig script to read board
 configurations from a plain text file (table), boards.cfg.
 
 For simple boards it is now sufficient to add a single line of text to
 the boards.cfg file, no changes to the top level Makefile are needed
 any more.
 
 To make the table better readable, change the notation for unused
 fields from NULL into -.
 
 Signed-off-by: Wolfgang Denk w...@denx.de
 Cc: Peter Tyser pty...@xes-inc.com
 Cc: Mike Frysinger vap...@gentoo.org
 ---
 Note:
   I had to disable the simple and very convenient rule
   %: %_config
   $(MAKE)
   in the top level Makefile, because it caused each invocation
   of make to fail with an error message:
 
   make: *** No rule to make target `Makefile_config'.  Stop.
   
   Fixes welcome!

We're still looking for a clean solution for this problem...

 
  Makefile   |  823 
 ++--
  boards.cfg |  356 ++
  mkconfig   |   72 --
  3 files changed, 431 insertions(+), 820 deletions(-)
  create mode 100644 boards.cfg


Applied to next branch.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Faith may be defined briefly as an illogical belief in the  occurence
of the improbable.- H. L. Mencken
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4 v2] Makefile/mkconfig: read simple board configurations from boards.cfg

2010-05-27 Thread Wolfgang Denk
Instead of adding explicit build rules for each and every board to the
top level Makefile (which makes it grow and grow), we now provide a
simple default rule and extend the mkconfig script to read board
configurations from a plain text file (table), boards.cfg.

For simple boards it is now sufficient to add a single line of text to
the boards.cfg file, no changes to the top level Makefile are needed
any more.

To make the table better readable, change the notation for unused
fields from NULL into -.

Signed-off-by: Wolfgang Denk w...@denx.de
Cc: Peter Tyser pty...@xes-inc.com
Cc: Mike Frysinger vap...@gentoo.org
---
Note:
I had to disable the simple and very convenient rule
%: %_config
$(MAKE)
in the top level Makefile, because it caused each invocation
of make to fail with an error message:

make: *** No rule to make target `Makefile_config'.  Stop.

Fixes welcome!


 Makefile   |  823 ++--
 boards.cfg |  356 ++
 mkconfig   |   72 --
 3 files changed, 431 insertions(+), 820 deletions(-)
 create mode 100644 boards.cfg

diff --git a/Makefile b/Makefile
index 48ca9e5..9c4e600 100644
--- a/Makefile
+++ b/Makefile
@@ -475,8 +475,11 @@ unconfig:
$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
 
-%: %_config
-   $(MAKE)
+%_config:: unconfig
+   @$(MKCONFIG) -A $(@:_config=)
+
+##%: %_config
+## $(MAKE)
 
 #
 # Functions to generate common board directory names
@@ -489,50 +492,9 @@ ucname = $(shell echo $(1) | sed -e 
's/\(.*\)_config/\U\1/')
 #
 
 #
-## MPC5xx Systems
-#
-
-cmi_mpc5xx_config: unconfig
-   @$(MKCONFIG) $@ powerpc mpc5xx cmi
-
-PATI_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc5xx pati mpl
-
-#
 ## MPC5xxx Systems
 #
 
-# generic boards
-
-BC3450_config  \
-canmb_config   \
-cm5200_config  \
-hmi1001_config \
-jupiter_config \
-inka4x0_config \
-ipek01_config  \
-motionpro_config\
-mucmc52_config \
-munices_config \
-o2dnt_config   \
-uc101_config   \
-v38b_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc5xxx $(call lcname,$@)
-
-# vendor specific boards (sorted by vendor)
-###
-cpci5200_config\
-mecp5200_config\
-pf5200_config: unconfig
-   @$(MKCONFIG) $@ powerpc mpc5xxx $(call lcname,$@) esd
-
-aev_config \
-smmaco4_config \
-spieval_config:unconfig
-   @$(MKCONFIG) $@ powerpc mpc5xxx tqm5200 tqc
-
-# special boards
-
 digsy_mtc_config \
 digsy_mtc_LOWBOOT_config   \
 digsy_mtc_RAMBOOT_config:  unconfig
@@ -717,21 +679,6 @@ TQM5200_STK100_config: unconfig
 ## MPC512x Systems
 #
 
-# generic boards
-
-pdm360ng_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc512x $(call lcname,$@)
-
-# vendor specific boards (sorted by vendor)
-###
-aria_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc512x aria davedenx
-
-mecp5123_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc512x mecp5123 esd
-
-# special boards
-
 mpc5121ads_config \
 mpc5121ads_rev2_config \
: unconfig
@@ -745,80 +692,6 @@ mpc5121ads_rev2_config \
 ## MPC8xx Systems
 #
 
-# generic boards
-
-
-c2mon_config   \
-EP88x_config   \
-ESTEEM192E_config  \
-ETX094_config  \
-FLAGADM_config \
-GENIETV_config \
-GTH_config \
-hermes_config  \
-IP860_config   \
-LANTEC_config  \
-lwmon_config   \
-NX823_config   \
-quantum_config \
-R360MPI_config \
-RBC823_config  \
-rmu_config \
-spc1920_config \
-svm_sc8xx_config   \
-uc100_config   :   unconfig
-   @$(MKCONFIG) $@ powerpc mpc8xx $(call lcname,$@)
-
-RPXClassic_config  \
-RPXlite_config \
-RRvision_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc8xx $(@:_config=)
-
-# vendor specific boards (sorted by vendor)
-###
-
-MHPC_config:   unconfig
-   @$(MKCONFIG) $@ powerpc mpc8xx mhpc eltec
-
-TOP860_config: unconfig
-   @$(MKCONFIG) $@ powerpc mpc8xx top860 emk
-
-kmsupx4_config \
-mgsuvd_config  :   

Re: [U-Boot] [PATCH 4/4 v2] Makefile/mkconfig: read simple board configurations from boards.cfg

2010-05-27 Thread Peter Tyser
Hi Wolfgang,

snip

 Note:
   I had to disable the simple and very convenient rule
   %: %_config
   $(MAKE)
   in the top level Makefile, because it caused each invocation
   of make to fail with an error message:
 
   make: *** No rule to make target `Makefile_config'.  Stop.
   
   Fixes welcome!

I think adding the following line somewhere in the Makefile should allow
the %:%_config rule to be re-enabled:

Makefile:;

Without the above line, after uncommenting the %: %_config rule and
running make -d board the output shows that make is looking to
satisfy an implicit 'Makefile' rule which is eventually satisfied by the
%: %_config target, which causes the error you mention:
Reading makefile `Makefile'...
Updating makefiles
 Considering target file `Makefile'.
  Looking for an implicit rule for `Makefile'.
  Trying pattern rule with stem `Makefile'.
...
  Trying implicit prerequisite `Makefile_config'.
  Looking for a rule with intermediate file `Makefile_config'.
   Avoiding implicit rule recursion.
   Trying pattern rule with stem `Makefile'.
   Trying rule prerequisite `unconfig'.
  Found an implicit rule for `Makefile'.
Considering target file `unconfig'.
 File `unconfig' does not exist.
 Finished prerequisites of target file `unconfig'.
Must remake target `unconfig'.
Putting child 0x080a6f40 (unconfig) PID 20171 on the chain.
Live child 0x080a6f40 (unconfig) PID 20171 
Reaping winning child 0x080a6f40 PID 20171 
Removing child 0x080a6f40 PID 20171 from chain.
Successfully remade target file `unconfig'.
  Considering target file `Makefile_config'.
   File `Makefile_config' does not exist.
Pruning file `unconfig'.
   Finished prerequisites of target file `Makefile_config'.
  Must remake target `Makefile_config'.


If the unconfig dependency of the %_config rule is removed,
Makefile_config no longer needs to be built, and building works
expected.  Weird...  So I'm not sure why the unconfig dependency makes a
difference.  Anyone have any clue?

As a basic test, the following works as expected (eg try running 'make
asdf'):
unconfig:
@echo UNCONFIG for $@
baz_config:
@echo applying target baz rules for $...@.
%_config:
@echo applying DEFAULT rules for $...@.
%:  %_config
@echo DEFAULT_config for $@

while the following exhibits the issue Wolfgang pointed out:
unconfig:
@echo UNCONFIG for $@
baz_config:
@echo applying target baz rules for $...@.
%_config: unconfig
@echo applying DEFAULT rules for $...@.
%:  %_config
@echo DEFAULT_config for $@

The fix mentioned at the top would look like:
Makefile:;
unconfig:
@echo unconfig for $@
baz_config:
@echo applying target baz rules for $...@.
%_config: unconfig
@echo applying default rules for $...@.
%:  %_config
@echo default_config for $@


For what its worth the Linux kernel also has the empty Makefile rule.
Out of curiosity, anyone know why the unconfig dependency of %_config
makes any difference?  I don't quite get why it does, but I don't think
adding the empty Makefile rule has any real downsides, and may actually
be an improvement so make doesn't waste its time looking for
Makefile.xyz targets we don't care about.

Best,
Peter

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4 v2] Makefile/mkconfig: read simple board configurations from boards.cfg

2010-05-27 Thread Peter Tyser
On Fri, 2010-05-28 at 00:13 -0500, Peter Tyser wrote:
 Hi Wolfgang,
 
 snip
 
  Note:
  I had to disable the simple and very convenient rule
  %: %_config
  $(MAKE)
  in the top level Makefile, because it caused each invocation
  of make to fail with an error message:
  
  make: *** No rule to make target `Makefile_config'.  Stop.
  
  Fixes welcome!
 
 I think adding the following line somewhere in the Makefile should allow
 the %:%_config rule to be re-enabled:
 
 Makefile:;

Maybe I spoke too soon...  It seems that make looks for other files that
are dependencies, but don't have explicit rules.  Like
include/autoconf.mk, config.mk, etc.  Linux has a number of implicit
rule overrides (search for implicit in its top-level Makefile) that
appear to be for the same type of issue.  This seems like a somewhat
hokey fix to have a number of empty rules defined though.  Any better
ideas or comments on why this issue didn't exist before?

Best,
Peter

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot