Re: [RFCv3] Kbuild: factor parser rules

Michal Marek
2011-06-07T15:29:53Z

On Fri, Jun 03, 2011 at 01:16:52PM -0400, Arnaud Lacombe wrote:
> Hi Michal,
>
> Here is some update concerning the parser generation merge. I do not repost the
> whole serie as it may be overkill. You can find the latest branch at:
>
> git://github.com/lacombar/linux-2.6.git kbuild-implicit-parser-rule
>
> You'll find an updated diff between v2 [rebased on top of v3.0-rc1] and v3
> below.
>
> Changes since v2:
> - allow a parser to specify the prefix to be used. This will allow for multiple
> parser to use the implicit rules, which was not previously possible, as it
> was using the `yy' default.
> - drop the zconf prefix changes
> - add a `baseprereq' global to kbuild, which mimics `basetarget'
> - rebase on top of v3.0-rc1

Nice. But it still breaks the _shipped rule for files other than those
handled explicitely. I guess the problem you are trying to solve is the
double-colon in rule? That was added back in 2002 by
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=2e8556ce
and it looks to me like a hack to make the _shipped rule fire early
enough. Maybe it's not needed nowadays at all, because 53c700.o is a
normal object file and not the final module. Nevertheless, if I change
it to a normal rule and delete the ones added by you, it all works fine
except for genksyms:

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f76d9ba..520f958 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -192,20 +192,10 @@ endif
quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@

-$(obj)/%.tab.c: $(src)/%.tab.c_shipped
- $(call cmd,shipped)
-
-$(obj)/%.tab.h: $(src)/%.tab.h_shipped
- $(call cmd,shipped)

-$(obj)/%.lex.c: $(src)/%.lex.c_shipped
+$(obj)/%: $(src)/%_shipped
$(call cmd,shipped)

-$(obj)/%.hash.c: $(src)/%.hash.c_shipped
- $(call cmd,shipped)
-
-$(obj)/%:: $(src)/%_shipped
-
# Commands useful for building a boot image
# ===========================================================================
#

I'll look into the problem with genksyms later today.

Michal