[SOLVED] Makefile for module in and out of Kconfig/Kbuild system
What I want to do is be able to build a module both inside and outside of the kernel build system.
- Inside=at the top level of the Linux sources do: make menuconfig, make etc
- Outside=just go into a working directory with the module source in and type 'make'
In my Kbuild I have:
obj-$(CONFIG_THING) := thing.o
thing-y := thing_1.o \
This works when I build within the kernel build system (make menuconfig, make etc...)
when I set CONFIG_THING to m via the Kconfig system I get a thing.ko built.
when I set CONFIG_THING to y via the Kconfig system I get thing support built into the kernel.
I thought that a Makefile similar to that below would help, but obviously CONFIG_THING does not
get set correctly.
# Normal Makefile
KERNELDIR := /lib/modules/`uname -r`/build
CONFIG_THING = m
$(MAKE) -C $(KERNELDIR) M=`pwd` $@
# Module clean up
$(MAKE) -C $(KERNELDIR) M=`pwd` clean
Is there any way I can force CONFIG_THING to be 'm' in order to reuse the Kbuild file?