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

Peter Tyser ptyser at xes-inc.com
Fri May 28 07:13:11 CEST 2010


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



More information about the U-Boot mailing list