$(MAKE) -C $(KERNELDIR) M= $(PWD) modules

 转载于: http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29523795&id=4209690
 

在mini2440资料的LED驱动编程的编译makefile里面看到这样一句话,-C是表示进入$(KERNELDIR)目录执行makefile,而M不是makefile的选项,是内核根目录下的Makefile中使用的变量。

# Use make M=dir to specify directory of external module to build 
# Old syntax make ... SUBDIRS=$PWD is still supported 
# Setting the environment variable KBUILD_EXTMOD take precedence 
ifdef SUBDIRS 
KBUILD_EXTMOD ?= $(SUBDIRS) 
endif 
ifdef M //如果没有定义或赋值M,此处M未定义(undefined) 
ifeq ("$(origin M)", "command line") //如果定义了,此句用来判断M是否从命令行来 
KBUILD_EXTMOD := $(M) 
endif 
endif

posted on 2016-12-20 14:54  Red_Point  阅读(1796)  评论(0)    收藏  举报

导航