转载地址:http://blog.csdn.net/xiaowulang20082008/article/details/50586985
#kbuild syntax. dependency relationshsip of files and target modules are listed here.
obj-m := helloworld.o
PWD
KERNEL_VER ?= $(shell uname -r)
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions *.order *symvers
shawn@shawn-VirtualBox:~/fly/tmp$ make
make -C /lib/modules/3.16.0-30-generic/build M=/home/shawn/fly/tmp
make[1]: 正在进入目录 `/usr/src/linux-headers-3.16.0-30-generic'
LD /home/shawn/fly/tmp/built-in.o
CC [M] /home/shawn/fly/tmp/helloworld.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/shawn/fly/tmp/helloworld.mod.o
LD [M] /home/shawn/fly/tmp/helloworld.ko
make[1]:正在离开目录 `/usr/src/linux-headers-3.16.0-30-generic'
shawn@shawn-VirtualBox:~/fly/tmp$