On Wed, Oct 29, 2008 at 2:12 PM, Sam Ravnborg [EMAIL PROTECTED] wrote:
On Sun, Oct 26, 2008 at 07:12:53PM -0400, Paul Smith wrote:
...
Makefile:442: *** mixed implicit and normal rules. Stop.
config %config: scripts_basic outputmakefile FORCE
$(Q)mkdir -p include/linux include/config
$(Q)$(MAKE) $(build)=scripts/kconfig $@
Here I try to catch the following:
make config
make menuconfig
make xconfig
make foobarconfig
I must admit I cannot see the problem with mixing implicit and normal
rules in the above. But I gues this is my simple use of it.
I see at least two ways in which it's confusing:
1) what prerequisites does foo have with this rule:
foo %.c: %.c.real
@: cp $ $@
2) rules with multiple pattern targets have special meaning to make:
Pattern rules may have more than one target. Unlike normal rules,
this does not act as many different rules with the same prerequisites
and commands. If a pattern rule has multiple targets, `make' knows that
the rule's commands are responsible for making all of the targets. ...
I.e., this rule:
%.a %.b:
${commands}
says that building bar.a will also build bar.b, and
building quux.a will also build quux.b. With this rule:
foo %.a %.b:
${commands}
should make assume that building bar.a will also build bar.b
*and* foo?
How about this rule:
foo blip %.a %.b:
${commands}
Will building bar.a also build bar.b, foo, and blip?
How about this one:
foo blip %.a:
${commands}
...whoops...
Do you have any god suggestion how to rewrite this?
Option 1: if make config is really the same as make fooconfig,
then actually set that equivalence in the makefile with something
like:
config: fooconfig
%config: scripts_basic outputmakefile FORCE
$(Q)mkdir -p include/linux include/config
$(Q)$(MAKE) $(build)=scripts/kconfig $@
Option 2: if the list of config types is basically static, then just
list them explicitly:
CONFIG_TARGETS = config menuconfig xconfig foobarconfig
${CONFIG_TARGETS}: scripts_basic outputmakefile FORCE
$(Q)mkdir -p include/linux include/config
$(Q)$(MAKE) $(build)=scripts/kconfig $@
Option 3: if the list of config targets really does change regularly
or needs to be open-ended, then I would go with
CONFIG_DEP = scripts_basic outputmakefile FORCE
define CONFIG_COMMANDS
$(Q)mkdir -p include/linux include/config
$(Q)$(MAKE) $(build)=scripts/kconfig $@
endef
# normal and pattern targets are immiscible in a single rule
config: ${CONFIG_DEP}; ${CONFIG_COMMANDS}
%config: ${CONFIG_DEP}; ${CONFIG_COMMANDS}
(The version using $(eval) and $(foreach) is just icky looking in my mind)
Philip Guenther
___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make