Skip to contentSkip to conversation

pass CONFIG_FOO to CC problem

question Coywolf Qi Hunt 4 participants 5 messages Jun 22, 2005 – Jun 23, 2005

lore
Share & tools
lore
#0 lore raw

Hello,

I was expecting kbuild passes CONFIG_FOO from .config to CC -DCONFIG_FOO, but it doesn't. So I have to add

ifdef CONFIG_FOO
EXTRA_CFLAGS += -DCONFIG_FOO
endif

Is that the right way? thanks in advance.

Signature · 2 lines
Coywolf Qi Hunt
http://ahbl.org/~coywolf/
#1 lore raw
Quoted 10 lines · Coywolf Qi Hunt

Hello,

I was expecting kbuild passes CONFIG_FOO from .config to CC -DCONFIG_FOO, but it doesn't. So I have to add

ifdef CONFIG_FOO
EXTRA_CFLAGS += -DCONFIG_FOO
endif

Is that the right way? thanks in advance.

I think you need to #include <linux/config.h>

Ian.

Signature · 5 lines
Ian Campbell

BOFH excuse #186:

permission denied
#2 lore raw
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Coywolf Qi Hunt

Hello,

I was expecting kbuild passes CONFIG_FOO from .config to CC -DCONFIG_FOO, but it doesn't. So I have to add

Quoted 7 lines
Quoted 5 lines

ifdef CONFIG_FOO
EXTRA_CFLAGS += -DCONFIG_FOO
endif

Is that the right way? thanks in advance.

I think you need to #include <linux/config.h>

Yes, exactly. thanks

#3 lore raw
In reply to Coywolf Qi Hunt

Hi Coywolf :)

* Coywolf Qi Hunt <[email protected]> dixit:

Quoted 6 lines

I was expecting kbuild passes CONFIG_FOO from .config to CC -DCONFIG_FOO, but it doesn't. So I have to add

ifdef CONFIG_FOO
EXTRA_CFLAGS += -DCONFIG_FOO
endif

NO! You don't do it that way in the kernel. Think: if you have to
pass a '-D' option for each config item you set, you will end up with TONS of '-D' options, in fact you probably exceed the command line size limit.

You have to include <linux/config.h> if I recall correctly ;)

Good luck!

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
#4 lore raw
Quoted 6 lines · DervishD

Hi Coywolf :)

* Coywolf Qi Hunt <[email protected]> dixit:

Quoted 3 lines

I was expecting kbuild passes CONFIG_FOO from .config to CC -DCONFIG_FOO, but it doesn't. So I have to add

Quoted 8 lines
Quoted 3 lines

ifdef CONFIG_FOO
EXTRA_CFLAGS += -DCONFIG_FOO
endif

NO! You don't do it that way in the kernel. Think: if you have to
pass a '-D' option for each config item you set, you will end up with TONS of '-D' options, in fact you probably exceed the command line size limit.

I see. It's not only ugly, but also harmful.

Quoted 3 lines

You have to include <linux/config.h> if I recall correctly ;)

<linux/config.h> is for this purpose, if I understand correctly.

Coywolf