天天看點

include/generated/autoconf.h

             執行make menuconfig後,編譯系統會把所有的配置資訊儲存到源碼頂層目錄下的.config檔案中,然後将.config中的内容轉換為C語言能識别的宏定義更新到include/generated目錄下的autoconf.h檔案中。比如會将CONFIG_XXX =y的定義轉換為#define CONFIG_XXX 1的模式寫到autoconf.h檔案當中。autoconf.h檔案是被自動包含,不需要C代碼檔案中顯式包含。在核心源碼的根目錄下的Makefile中實作了自動包含,頂層Makefile中相關的内容如下:

# Use LINUXINCLUDE when you must reference the include/ directory.

# Needed to be compatible with the O= option

LINUXINCLUDE    := -I$(srctree)/arch/$(hdr-arch)/include \

                   -Iarch/$(hdr-arch)/include/generated -Iinclude \

                   $(if $(KBUILD_SRC), -I$(srctree)/include) \

                   -include include/generated/autoconf.h 

............................

............................

............................

export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS

在LINUXINCLUDE指派的最後一行包含了autoconf.h檔案,然後通過export導出給其它的Makefile檔案使

繼續閱讀