On Thu, Dec 10, 2009 at 01:45:30PM +1300, Michal Ludvig wrote: > Hi, > > is it somehow possible to generate two separate kernel modules from one > source file? > > What I want is roughly: > mymodule-type1.ko compiled from: mymodule.c -D_TYPE_1 > and > mymodule-type2.ko compiled from: mymodule.c -D_TYPE_2 > > obj-m += mymodule-type1.o > obj-m += mymodule-type2.o > CFLAGS_mymodule-type1.o = -D_TYPE_1 > CFLAGS_mymodule-type2.o = -D_TYPE_2 > > and mymodule.c symlinked to mymodule-type1.c and mymodule-type2.c > Now I'd like to get rid of the symlinks. > > I've gone through the kbuild docs but can't find how to do that. Any ideas? You can't do it directly. You can do it by a trick of having the .c file included from another .c file. But I really don't recommend doing it, please figure out how to handle both code types together in the same module, as the same time, that's the only way the code would be acceptable to the kernel community. good luck, greg k-h -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ