RE: Compiling Module with Multiple Files

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

 



Dear Sanjay,

> [file1.c contains module_init and module_exit. File2.c contains few
> functions called by  file1.c ]
> 
> 
> obj-m := file_module.o
> fast_module-objs := file2.o file1.o
> 
> default:
>         $(MAKE) -w -C /usr/src/linux-2.6.7-DSL SUBDIRS=`pwd` modules


To compile multiple files use the following Makefile.

KDIR:=/lib/modules/$(shell uname -r)/build
TRGT:=file_module
OBJS:=file1.o file2.o

obj-m += $(TRGT).o
$(TRGT)-objs := $(OBJS)

default:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
	$(RM) *.ko *.o

Regards,
Srinivas G

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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