转载地址:http://blog.youkuaiyun.com/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$
本文介绍Makefile在嵌入式开发中的作用及如何使用-C和M=参数。通过示例说明了如何配置Makefile来编译内核模块,并解释了这些配置如何帮助管理和构建大型项目。
1083

被折叠的 条评论
为什么被折叠?



