Compile multiple modules with a single makefile

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

 



Hi all,

I have the one .c source file that I want to create multiple kernel modules out of it by setting macros using the makefile. 

The idea is that if -DMODULE1 is set, I'll build module1.ko and if -DMODULE2 is set, I'll build module 2.

Does anyone know how to do this? I created the following makefile:

...
module1: override obj-m := module1.o
module1: EXTRA_CFLAGS += -DMODULE1

module1:
$(MAKE) -C $(KDIR) M=$(PWD) modules

module2: override obj-m := module2.o
module2: EXTRA_CFLAGS += -DMODULE2

module2:
$(MAKE) -C $(KDIR) M=$(PWD) modules
...

But it isn't working as I expected. Anyone with kernel build system experience knows the answer for that?

Thanks,
--
Henrique Rodrigues
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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