SUBDIRS variable in kernel module makefile

前端 未结 1 1265
囚心锁ツ
囚心锁ツ 2021-01-19 18:21

Consider the following makefile:

CUR = $(shell uname -r) 
DIR = /lib/modules/$(CUR)/build 
PWD = $(shell pwd) 
obj-m   := m1.o m2.o 
default: 
        $(MAKE         


        
相关标签:
1条回答
  • 2021-01-19 18:42

    the kernel document says in Documentation/kbuild/modules.txt,

    link: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/kbuild/modules.txt?id=refs/tags/v2.6.34.14

    Same as M=. The SUBDIRS= syntax is kept for backwards compatibility.

    and from Documentation/kbuild/kbuild.txt

    link: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/kbuild/kbuild.txt?id=refs/tags/v2.6.34.14

    KBUILD_EXTMOD
    --------------------------------------------------
    Set the directory to look for the kernel source when building external
    modules.
    The directory can be specified in several ways:
    1) Use "M=..." on the command line
    2) Environmnet variable KBUILD_EXTMOD
    3) Environmnet variable SUBDIRS
    The possibilities are listed in the order they take precedence.
    Using "M=..." will always override the others.
    
    0 讨论(0)
提交回复
热议问题