Re: kbuild - two obj's from one source

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

 



On Fri, Dec 11, 2009 at 01:33:08PM +1300, Michal Ludvig wrote:
> On 12/10/2009 06:11 PM, Greg KH wrote:
> > 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
> > [..]
> > 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.
> 
> Thanks Greg. I have factored the type1/type2 backends out to two
> separate source files and link the two kernel modules from a common
> frontend and one of the backends. The Makefile now looks much cleaner too.

See, the limitations of the build service are there for a reason, it
forces you to write cleaner code :)

Glad it's now working,

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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux