lkml.org 
[lkml]   [2009]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Kconfig, Makefile and ifdef: mod as yes vs. no?
On Sat, 11 Jul 2009 17:53:43 -0400
Kyle McMartin <kyle@mcmartin.ca> wrote:

> On Sun, Jul 12, 2009 at 12:06:25AM +0300, Pekka Paalanen wrote:
> > +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
> >
>
> You need to test _MODULE for the symbol too... since it's necessary to
> be able to distinguish between symbols which exist in the vmlinux, and
> symbols which require a module to be loaded.
>
> #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) &&
> defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
>
> should work.

Just || instead of &&, and yes, this is a solution for half of the problem,
thanks.

But what about the Makefile?

nouveau-y := nouveau_drv.o ...
nouveau-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += nouveau_backlight.o
obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o

With this, nouveau_backlight.o is not built if
CONFIG_BACKLIGHT_CLASS_DEVICE=m. Should I write:

nouveau-$(if $(findstring m,$(CONFIG_BACKLIGHT_CLASS_DEVICE)),y,n) += \
nouveau_backlight.o

which to me looks ugly, or add a new Kconfig boolean option that is
selected 'if CONFIG_BACKLIGHT_CLASS_DEVICE' and use that in both Makefile
and code, or is there a canonical way to do this?

Other code seems to deal with a similar situation by #ifdef'ing the
whole c-file contents. That cannot be the preferred way, can it?


Thanks.

--
Pekka Paalanen
http://www.iki.fi/pq/


\
 
 \ /
  Last update: 2009-07-12 11:13    [W:0.087 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site