From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Sat, 13 Sep 2014 08:13:20 -0700 Subject: Makefile for a single source file In-Reply-To: References: Message-ID: <20140913151320.GA1705@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Sat, Sep 13, 2014 at 05:34:11PM +0300, Kevin Wilson wrote: > Hi, > I have a single source file which I wrote, implementing a kernel > module: helloworld.c > > In order to built it, I prepared the following Makefile: > > obj-m += helloworld.o > > all: > make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules > > clean: > make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean > > > > Is it ok ? or should the obj-m parameter be *different* than the the > source file (without the *.o suffix) > (something like obj-m += hello.o ?) Does the above work for you? Have you read the kernel documentation about how to write stand-alone Makefiles? It should answer this question for you, right? thanks, greg k-h