Hi all. I'm trying to build an out-of-tree module, which actually has
configuration associated with it (it has a Kconfig file and
everything--although that doesn't help me for out-of-tree builds of
I have my own makefile which invokes the appropriate kbuild-based make
(setting O= etc. on the command line). I know what configure options I
want to set as well.
So, I wanted to figure out how just pass a couple of -DCONFIG_...=... on
the kbuild make command line such that they would be added to the
compile line of my out-of-tree modules. Unfortunately I can't use
EXTRA_CFLAGS (easily) because the out-of-tree module Makefile sets some
flags in EXTRA_CFLAGS itself. All things being equal I'd prefer not to
change the module code, or have to duplicate those flags on my
In normal make, the CPPFLAGS variable contains C preprocessor options
and is included in each compile line automatically. I can see that
kbuild supports EXTRA_CPPFLAGS and cppflags-y etc. but these seem to
have a different purpose; anyway they don't appear on any normal compile
line. Is this an oversight? What are these cppflags variables intended
for? I'm having a hard time finding where they are used.
I also see that I can set KCPPFLAGS on the command line and that works,
although I get a warning.
Is this (KCPPFLAGS) the intended solution for this type of thing,
Or is there another, better way to manage this?
BTW, I'm using a relatively old kernel (2.6.31) but I'm interested in
comments even if they apply only to newer kernels.