~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/build/Build.include

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/build/Build.include (Version linux-6.12-rc7) and /tools/build/Build.include (Version linux-5.1.21)


  1 ###                                                 1 ###
  2 # build: Generic definitions                        2 # build: Generic definitions
  3 #                                                   3 #
  4 #  Lots of this code have been borrowed or hea      4 #  Lots of this code have been borrowed or heavily inspired from parts
  5 #  of kbuild code, which is not credited, but       5 #  of kbuild code, which is not credited, but mostly developed by:
  6 #                                                   6 #
  7 #  Copyright (C) Sam Ravnborg <sam@mars.ravnbor      7 #  Copyright (C) Sam Ravnborg <sam@mars.ravnborg.org>, 2015
  8 #  Copyright (C) Linus Torvalds <torvalds@linux      8 #  Copyright (C) Linus Torvalds <torvalds@linux-foundation.org>, 2015
  9 #                                                   9 #
 10                                                    10 
 11 ###                                                11 ###
 12 # Convenient variables                             12 # Convenient variables
 13 comma   := ,                                       13 comma   := ,
 14 squote  := '                                       14 squote  := '
 15 pound   := \#                                      15 pound   := \#
 16                                                    16 
 17 ###                                                17 ###
 18 # Name of target with a '.' as filename prefix     18 # Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
 19 dot-target = $(dir $@).$(notdir $@)                19 dot-target = $(dir $@).$(notdir $@)
 20                                                    20 
 21 ###                                                21 ###
 22 # filename of target with directory and extens     22 # filename of target with directory and extension stripped
 23 basetarget = $(basename $(notdir $@))              23 basetarget = $(basename $(notdir $@))
 24                                                    24 
 25 ###                                                25 ###
 26 # The temporary file to save gcc -MD generated     26 # The temporary file to save gcc -MD generated dependencies must not
 27 # contain a comma                                  27 # contain a comma
 28 depfile = $(subst $(comma),_,$(dot-target).d)      28 depfile = $(subst $(comma),_,$(dot-target).d)
 29                                                    29 
 30 ###                                                30 ###
 31 # Check if both arguments has same arguments.      31 # Check if both arguments has same arguments. Result is empty string if equal.
 32 arg-check = $(strip $(filter-out $(cmd_$(1)),      32 arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
 33                     $(filter-out $(cmd_$@),        33                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
 34                                                    34 
 35 ###                                                35 ###
 36 # Escape single quote for use in echo statemen     36 # Escape single quote for use in echo statements
 37 escsq = $(subst $(squote),'\$(squote)',$1)         37 escsq = $(subst $(squote),'\$(squote)',$1)
 38                                                    38 
 39 # Echo command                                     39 # Echo command
 40 # Short version is used, if $(quiet) equals `q     40 # Short version is used, if $(quiet) equals `quiet_', otherwise full one.
 41 echo-cmd = $(if $($(quiet)cmd_$(1)),\              41 echo-cmd = $(if $($(quiet)cmd_$(1)),\
 42            echo '  $(call escsq,$($(quiet)cmd_     42            echo '  $(call escsq,$($(quiet)cmd_$(1)))';)
 43                                                    43 
 44 ###                                                44 ###
 45 # Replace >$< with >$$< to preserve $ when rel     45 # Replace >$< with >$$< to preserve $ when reloading the .cmd file
 46 # (needed for make)                                46 # (needed for make)
 47 # Replace >#< with >$(pound)< to avoid startin     47 # Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file
 48 # (needed for make)                                48 # (needed for make)
 49 # Replace >'< with >'\''< to be able to enclos     49 # Replace >'< with >'\''< to be able to enclose the whole string in '...'
 50 # (needed for the shell)                           50 # (needed for the shell)
 51 make-cmd = $(call escsq,$(subst $(pound),$$(po     51 make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
 52                                                    52 
 53 ###                                                53 ###
 54 # Find any prerequisites that is newer than ta     54 # Find any prerequisites that is newer than target or that does not exist.
 55 # PHONY targets skipped in both cases.             55 # PHONY targets skipped in both cases.
 56 any-prereq = $(filter-out $(PHONY),$?) $(filte     56 any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
 57                                                    57 
 58 ###                                                58 ###
 59 # Copy dependency data into .cmd file              59 # Copy dependency data into .cmd file
 60 #  - gcc -M dependency info                        60 #  - gcc -M dependency info
 61 #  - command line to create object 'cmd_object     61 #  - command line to create object 'cmd_object :='
 62 dep-cmd = $(if $(wildcard $(fixdep)),              62 dep-cmd = $(if $(wildcard $(fixdep)),                                           \
 63            $(fixdep) $(depfile) $@ '$(make-cmd     63            $(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;           \
 64            rm -f $(depfile);                       64            rm -f $(depfile);                                                    \
 65            mv -f $(dot-target).tmp $(dot-targe     65            mv -f $(dot-target).tmp $(dot-target).cmd,                           \
 66            printf '$(pound) cannot find fixdep     66            printf '$(pound) cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
 67            printf '$(pound) using basic dep da     67            printf '$(pound) using basic dep data\n\n' >> $(dot-target).cmd;           \
 68            cat $(depfile) >> $(dot-target).cmd     68            cat $(depfile) >> $(dot-target).cmd;                                 \
 69            printf '\n%s\n' 'cmd_$@ := $(make-c     69            printf '\n%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd)
 70                                                    70 
 71 ###                                                71 ###
 72 # if_changed_dep  - execute command if any pre     72 # if_changed_dep  - execute command if any prerequisite is newer than
 73 #                   target, or command line ha     73 #                   target, or command line has changed and update
 74 #                   dependencies in the cmd fi     74 #                   dependencies in the cmd file
 75 if_changed_dep = $(if $(strip $(any-prereq) $(     75 if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)),         \
 76                   @set -e;                         76                   @set -e;                                         \
 77                   $(echo-cmd) $(cmd_$(1));     !!  77                   $(echo-cmd) $(cmd_$(1)) && $(dep-cmd))
 78                   $(dep-cmd))                  << 
 79                                                    78 
 80 # if_changed      - execute command if any pre     79 # if_changed      - execute command if any prerequisite is newer than
 81 #                   target, or command line ha     80 #                   target, or command line has changed
 82 if_changed = $(if $(strip $(any-prereq) $(arg-     81 if_changed = $(if $(strip $(any-prereq) $(arg-check)),                   \
 83               @set -e;                             82               @set -e;                                                   \
 84               $(echo-cmd) $(cmd_$(1));             83               $(echo-cmd) $(cmd_$(1));                                   \
 85               printf '%s\n' 'cmd_$@ := $(make-     84               printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
 86                                                    85 
 87 ###                                                86 ###
 88 # C flags to be used in rule definitions, incl     87 # C flags to be used in rule definitions, includes:
 89 # - depfile generation                             88 # - depfile generation
 90 # - global $(CFLAGS)                               89 # - global $(CFLAGS)
 91 # - per target C flags                             90 # - per target C flags
 92 # - per object C flags                             91 # - per object C flags
 93 # - BUILD_STR macro to allow '-D"$(variable)"'     92 # - BUILD_STR macro to allow '-D"$(variable)"' constructs
 94 c_flags_1 = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CF     93 c_flags_1 = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
 95 c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(bas     94 c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(c_flags_1))
 96 c_flags   = $(filter-out $(CFLAGS_REMOVE_$(obj     95 c_flags   = $(filter-out $(CFLAGS_REMOVE_$(obj)), $(c_flags_2))
 97 cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CX     96 cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
 98                                                    97 
 99 ###                                                98 ###
100 ## HOSTCC C flags                                  99 ## HOSTCC C flags
101                                                   100 
102 host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $ !! 101 host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))
103                                                << 
104 # output directory for tests below             << 
105 TMPOUT = .tmp_$$$$                             << 
106                                                << 
107 # try-run                                      << 
108 # Usage: option = $(call try-run, $(CC)...-o " << 
109 # Exit code chooses option. "$$TMP" serves as  << 
110 # automatically cleaned up.                    << 
111 try-run = $(shell set -e;               \      << 
112         TMP=$(TMPOUT)/tmp;              \      << 
113         mkdir -p $(TMPOUT);             \      << 
114         trap "rm -rf $(TMPOUT)" EXIT;   \      << 
115         if ($(1)) >/dev/null 2>&1;      \      << 
116         then echo "$(2)";               \      << 
117         else echo "$(3)";               \      << 
118         fi)                                    << 
119                                                << 
120 # cc-option                                    << 
121 # Usage: cflags-y += $(call cc-option,-march=w << 
122 cc-option = $(call try-run, \                  << 
123         $(CC) -Werror $(1) -c -x c /dev/null - << 
124                                                << 
125 # delete partially updated (i.e. corrupted) fi << 
126 .DELETE_ON_ERROR:                              << 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php