Re: modversion.h improvement suggestion

Olaf Titz (olaf@bigred.inka.de)
Mon, 06 May 2002 23:03:34 +0200


> The build instructions for third party modules should say something
> like
>
> If your kernel was built with CONFIG_MODVERSIONS=y then add these
> flags to the build for this module
>
> -DMODVERSIONS -include kernel_source_tree/linux/modversions.h

or even better, pick up the _complete_ compilation rule from the
kernel Makefile, since this is (unfortunately) by now the only way to
get all compiler options right.

I do it this way (in a configure.in for an external module):
KSRC is the kernel source location.

cp $KSRC/Makefile conftest.make
echo -e "conftest.CC:" >>conftest.make
echo -e "\t@echo \$(CC)" >>conftest.make
echo -e "conftest.CFLAGS:" >>conftest.make
echo -e "\t@echo \$(CFLAGS) \$(MODFLAGS)" >>conftest.make
here=`pwd`
NKCC=`cd $KSRC; $MAKE -s -f $here/conftest.make conftest.CC`
NKCFLAGS=`cd $KSRC; $MAKE -s -f $here/conftest.make conftest.CFLAGS`

i.e. copy the main Makefile, add a few rules to just echo the flags,
and then invoke it in the original place (since it depends on that).
We should really have a more elegant way to extract this info from the
main Makefile.

> In any case, modversions.h will disappear in kbuild 2.5.

which leaves hope this issue will be addressed...

Olaf

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/