[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

resolving a kbuild conflict - in-kernel vs module




Ive worked up a patchset to add support for PC-87366 GPIO, it derives from SCx200 GPIO, which it refactors to pull common stuff into a new file/module; nsc_gpio

Until today, Ive built all 3 as modules, all based upon the
SCX200_GPIO config item.

Today I added a 2nd item: PC87366_GPIO, as follows:

obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o nsc_gpio.o
obj-$(CONFIG_PC87366_GPIO) += pc87366_gpio.o nsc_gpio.o

This seems to work for normal configs; choosing either item above
results in nsc_gpio.ko also being built & installed.

BUT, when I purposely mis-configure, ie build 1 as module, other as built-in,
things break: the built module is missing its dependency (which may be built into
the kernel properly, but its apparently unavailable to the module)


So the questions:

How do I prevent a mis-configuration like this ?

this would work...
ifneq (obj-$(CONFIG_SCx200_GPIO),n)
   ifneq (obj-$(CONFIG_PC87366_GPIO), n)
      ifneq (obj-$(CONFIG_SCx200_GPIO), obj-$(CONFIG_PC87366_GPIO))
            error ()

but how to do the error ()

Or is this just sweating the details ?

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/