中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        [轉(zhuǎn)貼]Makefile解讀

        作者: 時(shí)間:2007-05-23 來(lái)源:網(wǎng)絡(luò) 收藏
        原文出自:http://www.linuxforum.net
        作者:jkl

        ==========================================
        初探
        ==========================================
        的內(nèi)核配置文件有兩個(gè),一個(gè)是隱含的.config文件,嵌入到主中;另一個(gè)是include/linux/autoconf.h,嵌入到各個(gè)c源文件中,它們由make config、make menuconfig、make xconfig這些過(guò)程創(chuàng)建。幾乎所有的源文件都會(huì)通過(guò)linux/config.h而嵌入autoconf.h,如果按照通常方法建立文件依賴關(guān)系(.depend),只要更新過(guò)autoconf.h,就會(huì)造成所有源代碼的重新編繹。

        為了優(yōu)化make過(guò)程,減少不必要的重新編繹,開(kāi)發(fā)了專用的mkdep工具,用它來(lái)取代gcc來(lái)生成.depend文件。mkdep在處理源文件時(shí),忽略linux/config.h這樣的頭文件,識(shí)別源文件宏指令中具有"CONFIG_"特征的行。例如,如果有"#ifdef CONFIG_SMP"這樣的行,它就會(huì)在.depend文件中輸出$(wildcard /usr/src/linux/include/config/smp.h)。

        include/config/下的文件是另一個(gè)工具split-include從autoconf.h中生成,它利用autoconf.h中的CONFIG_標(biāo)記,生成與mkdep相對(duì)應(yīng)的文件。例如,如果autoconf.h中有"#undef CONFIG_SMP"這一行,它就生成include/config/smp.h文件,內(nèi)容為"#undef CONFIG_SMP"。這些文件名只在.depend文件中出現(xiàn),內(nèi)核源文件是不會(huì)嵌入它們的。每配置一次內(nèi)核,運(yùn)行split-include一次。split-include會(huì)檢查舊的子文件的內(nèi)容,確定是不是要更新它們。這樣,不管autoconf.h修改日期如何,只要其配置不變,make就不會(huì)重新編繹內(nèi)核。

        如果系統(tǒng)的編繹選項(xiàng)發(fā)生了變化,也能進(jìn)行增量編繹。為了做到這一點(diǎn),make每編繹一個(gè)源文件時(shí)生成一個(gè)flags文件。例如編繹sched.c時(shí),會(huì)在相同的目錄下生成隱含的.sched.o.flags文件。它是的一個(gè)片斷,當(dāng)make進(jìn)入某個(gè)子目錄編繹時(shí),會(huì)搜索其中的flags文件,將它們嵌入到Makefile中。這些flags代碼測(cè)試當(dāng)前的編繹選項(xiàng)與原來(lái)的是不是相同,如果相同,就將自已對(duì)應(yīng)的目標(biāo)文件加入FILES_FLAGS_UP_TO_DATE列表,然后,系統(tǒng)從編繹對(duì)象表中刪除它們,得到FILES_FLAGS_CHANGED列表,最后,將它們?cè)O(shè)為目標(biāo)進(jìn)行更新。

        下一步準(zhǔn)備逐步深入的剖析Makefile代碼。

        ==========================================
        Makefile解讀之二: sub-make
        ==========================================
        Linux各級(jí)內(nèi)核源代碼的子目錄下都有Makefile,大多數(shù)Makefile要嵌入主目錄下的Rule.make,Rule.make將識(shí)別各個(gè)Makefile中所定義的一些變量。變量obj-y表示需要編繹到內(nèi)核中的目標(biāo)文件名集合,定義O_TARGET表示將obj-y連接為一個(gè)O_TARGET名稱的目標(biāo)文件,定義L_TARGET表示將obj-y合并為一個(gè)L_TARGET名稱的庫(kù)文件。同樣obj-m表示需要編繹成模塊的目標(biāo)文件名集合。如果還需進(jìn)行子目錄make,則需要定義subdir-y和subdir-m。在Makefile中,用"obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o"和"subdir-$(CONFIG_EXT2_FS) += ext2"這種形式自動(dòng)為obj-y、obj-m、subdir-y、subdir-m添加文件名。有時(shí),情況沒(méi)有這么單純,還需要使用條件語(yǔ)句個(gè)別對(duì)待。Makefile中還有其它一些變量,如mod-subdirs定義了subdir-m以外的所有模塊子目錄。

        Rules.make是如何使make進(jìn)入子目錄的呢? 先來(lái)看subdir-y是如何處理的,在Rules.make中,先對(duì)subdir-y中的每一個(gè)文件名加上前綴"_subdir_"再進(jìn)行排序生成subdir-list集合,再以它作為目標(biāo)集,對(duì)其中每一個(gè)目標(biāo)產(chǎn)生一個(gè)子make,同時(shí)將目標(biāo)名的前綴去掉得到子目錄名,作為子make的起始目錄參數(shù)。subdir-m與subdir-y類(lèi)似,但情況稍微復(fù)雜一些。由于subdir-y中可能有模塊定義,因此利用mod-subdirs變量將subdir-y中模塊目錄提取出來(lái),再與subdir-m合成一個(gè)大的MOD_SUB_DIRS集合。subdir-m的目標(biāo)所用的前綴是"_modsubdir_"。

        一點(diǎn)說(shuō)明,子目錄中的Makefile與Rules.make都沒(méi)有嵌入.config文件,它是通過(guò)主Makefile向下傳遞MAKEFILES變量完成的。MAKEFILES是make自已識(shí)別的一個(gè)變量,在執(zhí)行新的Makefile之前,make會(huì)首先加載MAKEFILES所指的文件。在主Makefile中它即指向.config。


        ==========================================
        Makefile解讀之三: 模塊的版本化處理
        ==========================================
        模塊的版本化是內(nèi)核與模塊接口之間進(jìn)行嚴(yán)格類(lèi)型匹配的一種方法。當(dāng)內(nèi)核配置了CONFIG_MODVERSIONS之后,make dep操作會(huì)在include/linux/modules/目錄下為各級(jí)Makefile中export-objs變量所對(duì)應(yīng)的源文件生成擴(kuò)展名為.ver的文件。

        例如對(duì)于kernel/ksyms.c,make用以下命令生成對(duì)應(yīng)的ksyms.ver:

        gcc -E -D__KERNEL__ -D__GENKSYMS__ ksyms.c | /sbin/genksyms -k 2.4.1 >; ksyms.ver

        -D__GENKSYMS__的作用是使ksyms.c中的EXPORT_SYMBOL宏不進(jìn)行擴(kuò)展。genksyms命令識(shí)別EXPORT_SYMBOL()中的函數(shù)名和對(duì)應(yīng)的原型,再根據(jù)其原型計(jì)算出該函數(shù)的版本號(hào)。

        例如ksyms.c中有一行:
        EXPORT_SYMBOL(kmalloc);
        kmalloc原型是:
        void *kmalloc(size_t, int);
        genksyms程序?qū)?yīng)的輸出為:
        #define __ver_kmalloc 93d4cfe6
        #define kmalloc _set_ver(kmalloc)
        在內(nèi)核符號(hào)表和模塊中,kmalloc將變成kmalloc_R93d4cfe6。

        在生成完所有的.ver文件后,make將重建include/linux/modversions.h文件,它包含一系列#include指令行嵌入各個(gè).ver文件。在編繹內(nèi)核本身export-objs中的文件時(shí),make會(huì)增加一個(gè)"-DEXPORT_SYMTAB"編繹標(biāo)志,它使源文件嵌入modversions.h文件,將EXPORT_SYMBOL宏展開(kāi)中的函數(shù)名字符串進(jìn)行版本名擴(kuò)展;同時(shí),它也定義_set_ver()宏為一空操作,使代碼中的函數(shù)名不受其影響。
        在編繹模塊時(shí),make會(huì)增加"-include=linux/modversion.h -DMODVERSIONS"編繹標(biāo)志,使模塊中代碼的函數(shù)名得到相應(yīng)版本擴(kuò)展。

        由于生成.ver文件比較費(fèi)時(shí),make還為每個(gè).ver創(chuàng)建了一個(gè)后綴為.stamp時(shí)戳文件。在make dep時(shí),如果其.stamp文件比源文件舊才重新生成.ver文件,否則只是更新.stamp文件時(shí)戳。另外,在生成.ver和modversions.h文件時(shí),make都會(huì)比較新文件和舊文件的內(nèi)容,保持它們修改時(shí)間為最舊。



        ==========================================
        Makefile解讀之四: Rules.make的注釋
        ==========================================
        #
        # This file contains rules which are shared between multiple Makefiles.
        #

        #
        # False targets.
        #
        #
        .PHONY: dummy

        #
        # Special variables which should not be exported
        #
        # 取消這些變量通過(guò)環(huán)境向make子進(jìn)程傳遞。
        unexport EXTRA_AFLAGS # as 的開(kāi)關(guān)
        unexport EXTRA_CFLAGS # cc 的開(kāi)關(guān)
        unexport EXTRA_LDFLAGS # ld 的開(kāi)關(guān)
        unexport EXTRA_ARFLAGS # ar 的開(kāi)關(guān)
        unexport SUBDIRS #
        unexport SUB_DIRS # 編繹內(nèi)核需進(jìn)入的子目錄,等于subdir-y
        unexport ALL_SUB_DIRS # 所有的子目錄
        unexport MOD_SUB_DIRS # 編繹模塊需進(jìn)入的子目錄
        unexport O_TARGET # ld合并的輸出對(duì)象
        unexport ALL_MOBJS # 所有的模塊名

        unexport obj-y # 編繹成內(nèi)核的文件集
        unexport obj-m # 編繹成模塊的文件集
        unexport obj-n #
        unexport obj- #
        unexport export-objs # 需進(jìn)行版本處理的文件集
        unexport subdir-y # 編繹內(nèi)核所需進(jìn)入的子目錄
        unexport subdir-m # 編繹模塊所需進(jìn)入的子目錄
        unexport subdir-n
        unexport subdir-

        #
        # Get things started.
        #
        first_rule: sub_dirs
        $(MAKE) all_targets

        # 在內(nèi)核編繹子目錄中過(guò)濾出可以作為模塊的子目錄。
        both-m := $(filter $(mod-subdirs), $(subdir-y))
        SUB_DIRS := $(subdir-y)
        # 求出總模塊子目錄
        MOD_SUB_DIRS := $(sort $(subdir-m) $(both-m))
        # 求出總子目錄
        ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))


        #
        # Common rules
        #
        # 將c文件編繹成匯編文件的規(guī)則,$@為目標(biāo)對(duì)象。
        %.s: %.c
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $ -o $@
        # 將c文件生成預(yù)處理文件的規(guī)則。
        %.i: %.c
        $(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $ >; $@
        # 將c文件編繹成目標(biāo)文件的規(guī)則,$為第一個(gè)所依賴的對(duì)象;
        #
        在目標(biāo)文件的目錄下生成flags文件,strip刪除多余的空格,subst將逗號(hào)替換成冒號(hào)
        。
        %.o: %.c
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $
        @ (
        echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS)
        $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS)
        $$(CFLAGS_$@))))' ;
        echo 'FILES_FLAGS_UP_TO_DATE += $@' ;
        echo 'endif'
        ) >; $(dir $@)/.$(notdir $@).flags
        # 匯編文件生成目標(biāo)文件的規(guī)則。
        %.o: %.s
        $(AS) $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $

        # Old makefiles define their own rules for compiling .S files,
        # but these standard rules are available for any Makefile that
        # wants to use them. Our plan is to incrementally convert all
        # the Makefiles to these standard rules. -- rmk, mec

        ifdef USE_STANDARD_AS_RULE
        # 匯編文件生成預(yù)處理文件的標(biāo)準(zhǔn)規(guī)則。
        %.s: %.S
        $(CPP) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) $ >; $@
        # 匯編文件生成目標(biāo)文件的標(biāo)準(zhǔn)規(guī)則。
        %.o: %.S
        $(CC) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) -c -o $@ $

        endif
        # c文件生成調(diào)試列表文件的規(guī)則,$*擴(kuò)展為目標(biāo)的主文件名。
        %.lst: %.c
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $
        $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP)
        #
        #
        #
        all_targets: $(O_TARGET) $(L_TARGET)

        #
        # Rule to compile a set of .o files into one .o file
        #
        ifdef O_TARGET
        $(O_TARGET): $(obj-y)
        rm -f $@
        # $^擴(kuò)展為全部依賴對(duì)象,如果obj-y為空就生成一個(gè)同名空的庫(kù)文件。
        ifneq $(strip $(obj-y))
        $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^)
        else
        $(AR) rcs $@
        endif
        # 生成flags文件的shell語(yǔ)句。
        @ (
        echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_LDFLAGS)
        $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_LDFLAGS) $$(obj-y))))' ;

        echo 'FILES_FLAGS_UP_TO_DATE += $@' ;
        echo 'endif'
        ) >; $(dir $@)/.$(notdir $@).flags
        endif # O_TARGET

        #
        # Rule to compile a set of .o files into one .a file
        #
        # 將obj-y組合成庫(kù)L_TARGET的方法。
        ifdef L_TARGET
        $(L_TARGET): $(obj-y)
        rm -f $@
        $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
        @ (
        echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_ARFLAGS)
        $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_ARFLAGS) $$(obj-y))))' ;

        echo 'FILES_FLAGS_UP_TO_DATE += $@' ;
        echo 'endif'
        ) >; $(dir $@)/.$(notdir $@).flags
        endif


        #
        # This make dependencies quickly
        #
        # wildcard為查找目錄中的文件名的宏。
        fastdep: dummy
        $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) >; .depend
        ifdef ALL_SUB_DIRS
        #
        將ALL_SUB_DIRS中的目錄名加上前綴_sfdep_作為目標(biāo)運(yùn)行子make,并將ALL_SUB_DIRS
        通過(guò)
        # 變量_FASTDEP_ALL_SUB_DIRS傳遞給子make。
        $(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS))
        _FASTDEP_ALL_SUB_DIRS=$(ALL_SUB_DIRS)
        endif

        ifdef _FASTDEP_ALL_SUB_DIRS
        #
        與上一段相對(duì)應(yīng),定義子目錄目標(biāo),并將目標(biāo)名還原為目錄名,進(jìn)入該子目錄make。
        $(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)):
        $(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep
        endif


        #
        # A rule to make subdirectories
        #
        # 下面2段完成內(nèi)核編繹子目錄中的make。
        subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS)))
        sub_dirs: dummy $(subdir-list)

        ifdef SUB_DIRS
        $(subdir-list) : dummy
        $(MAKE) -C $(patsubst _subdir_%,%,$@)
        endif

        #
        # A rule to make modules
        #
        # 求出有效的模塊文件表。
        ALL_MOBJS = $(filter-out $(obj-y), $(obj-m))
        ifneq $(strip $(ALL_MOBJS))
        # 取主目錄TOPDIR到當(dāng)前目錄的路徑。
        PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)
        endif

        unexport MOD_DIRS
        MOD_DIRS := $(MOD_SUB_DIRS) $(MOD_IN_SUB_DIRS)
        # 編繹模塊時(shí),進(jìn)入模塊子目錄的方法。
        ifneq $(strip $(MOD_DIRS))
        .PHONY: $(patsubst %,_modsubdir_%,$(MOD_DIRS))
        $(patsubst %,_modsubdir_%,$(MOD_DIRS)) : dummy
        $(MAKE) -C $(patsubst _modsubdir_%,%,$@) modules
        # 安裝模塊時(shí),進(jìn)入模塊子目錄的方法。
        .PHONY: $(patsubst %,_modinst_%,$(MOD_DIRS))
        $(patsubst %,_modinst_%,$(MOD_DIRS)) : dummy
        $(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install
        endif

        # make modules 的入口。
        .PHONY: modules
        modules: $(ALL_MOBJS) dummy
        $(patsubst %,_modsubdir_%,$(MOD_DIRS))

        .PHONY: _modinst__
        # 拷貝模塊的過(guò)程。
        _modinst__: dummy
        ifneq $(strip $(ALL_MOBJS))
        mkdir -p $(MODLIB)/kernel/$(PDWN)
        cp $(ALL_MOBJS) $(MODLIB)/kernel/$(PDWN)
        endif

        # make modules_install 的入口,進(jìn)入子目錄安裝。
        .PHONY: modules_install
        modules_install: _modinst__
        $(patsubst %,_modinst_%,$(MOD_DIRS))

        #
        # A rule to do nothing
        #
        dummy:

        #
        # This is useful for testing
        #
        script:
        $(SCRIPT)

        #
        # This sets version suffixes on exported symbols
        # Separate the object into normal objects and exporting objects
        # Exporting objects are: all objects that define symbol tables
        #
        ifdef CONFIG_MODULES
        # list-multi列出那些由多個(gè)文件復(fù)合而成的模塊;
        # 從編繹文件表和模塊文件表中過(guò)濾出復(fù)合模塊名。
        multi-used := $(filter $(list-multi), $(obj-y) $(obj-m))
        # 取復(fù)合模塊的構(gòu)成表。
        multi-objs := $(foreach m, $(multi-used), $($(basename $(m))-objs))
        # 求出需進(jìn)行編譯的總模塊表。
        active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))

        ifdef CONFIG_MODVERSIONS
        ifneq $(strip $(export-objs))
        # 如果有需要進(jìn)行版本化的文件。
        MODINCL = $(TOPDIR)/include/linux/modules

        # The -w option (enable warnings) for genksyms will return here in 2.1
        # So where has it gone?
        #
        # Added the SMP separator to stop module accidents between uniprocessor
        # and SMP Intel boxes - AC - from bits by Michael Chastain
        #

        ifdef CONFIG_SMP
        genksyms_smp_prefix := -p smp_
        else
        genksyms_smp_prefix :=
        endif
        # 從源文件計(jì)算版本文件的規(guī)則。
        $(MODINCL)/%.ver: %.c
        @if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $ ]; then
        echo '$(CC) $(CFLAGS) -E -D__GENKSYMS__ $';
        echo '| $(GENKSYMS) $(genksyms_smp_prefix) -k
        $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) >; $@.tmp';
        $(CC) $(CFLAGS) -E -D__GENKSYMS__ $
        | $(GENKSYMS) $(genksyms_smp_prefix) -k
        $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) >; $@.tmp;
        if [ -r $@ ] cmp -s $@ $@.tmp; then echo $@ is unchanged; rm -f
        $@.tmp;
        else echo mv $@.tmp $@; mv -f $@.tmp $@; fi;
        fi; touch $(MODINCL)/$*.stamp
        #
        將版本處理源文件的擴(kuò)展名改為.ver,并加上完整的路徑名,它們依賴于autoconf.h?br>;?br>;$(addprefix $(MODINCL)/,$(export-objs:.o=.ver)):
        $(TOPDIR)/include/linux/autoconf.h

        # updates .ver files but not modversions.h
        # 通過(guò)fastdep,逐個(gè)生成export-objs對(duì)應(yīng)的版本文件。
        fastdep: $(addprefix $(MODINCL)/,$(export-objs:.o=.ver))

        # updates .ver files and modversions.h like before (is this needed?)
        # make dep過(guò)程的入口
        dep: fastdep update-modverfile

        endif # export-objs

        # update modversions.h, but only if it would change
        # 刷新版本文件的過(guò)程。
        update-modverfile:
        @(echo #ifndef _LINUX_MODVERSIONS_H;
        echo #define _LINUX_MODVERSIONS_H;
        echo #include linux/modsetver.h>;;
        cd $(TOPDIR)/include/linux/modules;
        for f in *.ver; do
        if [ -f $$f ]; then echo #include linux/modules/$${f}>;; fi;
        done;
        echo #endif;
        ) >; $(TOPDIR)/include/linux/modversions.h.tmp
        @if [ -r $(TOPDIR)/include/linux/modversions.h ] cmp -s
        $(TOPDIR)/include/linux/modversions.h
        $(TOPDIR)/include/linux/modversions.h.tmp; then
        echo $(TOPDIR)/include/linux/modversions.h was not updated;
        rm -f $(TOPDIR)/include/linux/modversions.h.tmp;
        else
        echo $(TOPDIR)/include/linux/modversions.h was updated;
        mv -f $(TOPDIR)/include/linux/modversions.h.tmp
        $(TOPDIR)/include/linux/modversions.h;
        fi
        $(active-objs): $(TOPDIR)/include/linux/modversions.h

        else
        # 如果沒(méi)有配置版本化,modversions.h的內(nèi)容。
        $(TOPDIR)/include/linux/modversions.h:
        @echo #include linux/modsetver.h>; >; $@

        endif # CONFIG_MODVERSIONS

        ifneq $(strip $(export-objs))
        # 版本化目標(biāo)文件的編繹方法。
        $(export-objs): $(export-objs:.o=.c) $(TOPDIR)/include/linux/modversions.h
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
        @ (
        echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS)
        $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS)
        $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ;
        echo 'FILES_FLAGS_UP_TO_DATE += $@' ;
        echo 'endif'
        ) >; $(dir $@)/.$(notdir $@).flags
        endif

        endif # CONFIG_MODULES


        #
        # include dependency files if they exist
        #
        # 嵌入源文件之間的依賴關(guān)系。
        ifneq ($(wildcard .depend),)
        include .depend
        endif
        # 嵌入頭文件之間的依賴關(guān)系。
        ifneq ($(wildcard $(TOPDIR)/.hdepend),)
        include $(TOPDIR)/.hdepend
        endif

        #
        # Find files whose flags have changed and force recompilation.
        # For safety, this works in the converse direction:
        # every file is forced, except those whose flags are positively
        up-to-date.
        #
        # 已經(jīng)更新過(guò)的文件列表。
        FILES_FLAGS_UP_TO_DATE :=

        # For use in expunging commas from flags, which mung our checking.
        comma = ,
        # 將當(dāng)前目錄下所有flags文件嵌入。
        FILES_FLAGS_EXIST := $(wildcard .*.flags)
        ifneq ($(FILES_FLAGS_EXIST),)
        include $(FILES_FLAGS_EXIST)
        endif
        # 將無(wú)需更新的文件從總的對(duì)象中刪除。
        FILES_FLAGS_CHANGED := $(strip
        $(filter-out $(FILES_FLAGS_UP_TO_DATE),
        $(O_TARGET) $(L_TARGET) $(active-objs)
        ))

        # A kludge: .S files don't get flag dependencies (yet),
        # because that will involve changing a lot of Makefiles. Also
        # suppress object files explicitly listed in $(IGNORE_FLAGS_OBJS).
        # This allows handling of assembly files that get translated into
        # multiple object files (see arch/ia64/lib/idiv.S, for example).
        #
        # 將由匯編文件生成的目件文件從FILES_FLAGS_CHANGED刪除。
        FILES_FLAGS_CHANGED := $(strip
        $(filter-out $(patsubst %.S, %.o, $(wildcard *.S)
        $(IGNORE_FLAGS_OBJS)),
        $(FILES_FLAGS_CHANGED)))
        # 將FILES_FLAGS_CHANGED設(shè)為目標(biāo)。
        ifneq ($(FILES_FLAGS_CHANGED),)
        $(FILES_FLAGS_CHANGED): dummy
        endif
        /pre>;
        linux操作系統(tǒng)文章專題:linux操作系統(tǒng)詳解(linux不再難懂)


        關(guān)鍵詞: Makefile Linux

        評(píng)論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉