I have a meta-compiler I build w/ the kernel using a HOSTCC.  This
meta-compiler parses template files and outputs c code -- this process
needs to be called from a user_command block in several directories in
the kernel.  I need to pass in a -I<linux_dir> to the meta-compiler
where <linux_dir> is the path to the $(TOPDIR)/include linux headers.

In kbuild 2.4, it was really straight forward.  I would use the syntax:

MY_INCLUDE := -I$(TOPDIR)/include

mycode.c: mycode.template
        $(TOPDIR)/path/to/meta-compiler $(MY_INCLUDE) mycode.template

In kbuild 2.5, $(TOPDIR) is gone and AFAIK, nothing replaced it.  I have
come up with a mechanism to get around this in kbuild 2.5, but it is an
ugly hack. I use the src_includelist macro, but need to strip off the
directories past the toplevel linux directory to get the right path.

Here is what I use:

MY_INCLUDE :=  $(shell echo $(src_includelist include) | sed -e
"s|path/to/sourcedir/||")

user_command(mycode.c
        ($(srcfile mycode.template) $(objfile /path/to/meta-compiler))
        (set -e; $(objfile /path/to/meta-compiler) -o $(objdir) $(MY_INCLUDE)
$(srcfile mycode.template))
        ()
        )

so, $(src_includelist include) will return the source path to the
directory I am compiling w/ include appended.  and then I strip out that
sourcedir to go from /path/to/linux/source/path/to/sourcedir/include to
/path/to/linux/source/include.

Of course, I have to change the path/to/sourcedir/ in the MY_INCLUDE for
each directory's Makefile.in I am doing to reflect that directory's path
-- ugly!

there has got to be a better way to do this in kbuild 2.5...any ideas?

thanks,
-tduffy


_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to