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

TOMOYO Linux Cross Reference
Linux/tools/build/Makefile.build

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/Makefile.build (Version linux-6.12-rc7) and /tools/build/Makefile.build (Version linux-6.11.7)


  1 # SPDX-License-Identifier: GPL-2.0                  1 # SPDX-License-Identifier: GPL-2.0
  2 ###                                                 2 ###
  3 # Main build makefile.                              3 # Main build makefile.
  4 #                                                   4 #
  5 #  Lots of this code have been borrowed or hea      5 #  Lots of this code have been borrowed or heavily inspired from parts
  6 #  of kbuild code, which is not credited, but       6 #  of kbuild code, which is not credited, but mostly developed by:
  7 #                                                   7 #
  8 #  Copyright (C) Sam Ravnborg <sam@mars.ravnbor      8 #  Copyright (C) Sam Ravnborg <sam@mars.ravnborg.org>, 2015
  9 #  Copyright (C) Linus Torvalds <torvalds@linux      9 #  Copyright (C) Linus Torvalds <torvalds@linux-foundation.org>, 2015
 10 #                                                  10 #
 11                                                    11 
 12 PHONY := __build                                   12 PHONY := __build
 13 __build:                                           13 __build:
 14                                                    14 
 15 ifeq ($(V),1)                                      15 ifeq ($(V),1)
 16   quiet =                                          16   quiet =
 17   Q =                                              17   Q =
 18 else                                               18 else
 19   quiet=quiet_                                     19   quiet=quiet_
 20   Q=@                                              20   Q=@
 21 endif                                              21 endif
 22                                                    22 
 23 # If the user is running make -s (silent mode)     23 # If the user is running make -s (silent mode), suppress echoing of commands
 24 # make-4.0 (and later) keep single letter opti     24 # make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
 25 ifeq ($(filter 3.%,$(MAKE_VERSION)),)              25 ifeq ($(filter 3.%,$(MAKE_VERSION)),)
 26 short-opts := $(firstword -$(MAKEFLAGS))           26 short-opts := $(firstword -$(MAKEFLAGS))
 27 else                                               27 else
 28 short-opts := $(filter-out --%,$(MAKEFLAGS))       28 short-opts := $(filter-out --%,$(MAKEFLAGS))
 29 endif                                              29 endif
 30                                                    30 
 31 ifneq ($(findstring s,$(short-opts)),)             31 ifneq ($(findstring s,$(short-opts)),)
 32   quiet=silent_                                    32   quiet=silent_
 33 endif                                              33 endif
 34                                                    34 
 35 build-dir := $(srctree)/tools/build                35 build-dir := $(srctree)/tools/build
 36                                                    36 
 37 # Define $(fixdep) for dep-cmd function            37 # Define $(fixdep) for dep-cmd function
 38 ifeq ($(OUTPUT),)                                  38 ifeq ($(OUTPUT),)
 39   fixdep := $(build-dir)/fixdep                    39   fixdep := $(build-dir)/fixdep
 40 else                                               40 else
 41   fixdep := $(OUTPUT)/fixdep                       41   fixdep := $(OUTPUT)/fixdep
 42 endif                                              42 endif
 43                                                    43 
 44 # Generic definitions                              44 # Generic definitions
 45 include $(build-dir)/Build.include                 45 include $(build-dir)/Build.include
 46                                                    46 
 47 # do not force detected configuration              47 # do not force detected configuration
 48 -include $(OUTPUT).config-detected                 48 -include $(OUTPUT).config-detected
 49                                                    49 
 50 # Init all relevant variables used in build fi     50 # Init all relevant variables used in build files so
 51 # 1) they have correct type                        51 # 1) they have correct type
 52 # 2) they do not inherit any value from the en     52 # 2) they do not inherit any value from the environment
 53 subdir-y     :=                                    53 subdir-y     :=
 54 obj-y        :=                                    54 obj-y        :=
 55 subdir-y     :=                                    55 subdir-y     :=
 56 subdir-obj-y :=                                    56 subdir-obj-y :=
 57                                                    57 
 58 # Build definitions                                58 # Build definitions
 59 build-file := $(dir)/Build                         59 build-file := $(dir)/Build
 60 -include $(build-file)                             60 -include $(build-file)
 61                                                    61 
 62 quiet_cmd_flex  = FLEX    $@                       62 quiet_cmd_flex  = FLEX    $@
 63 quiet_cmd_bison = BISON   $@                       63 quiet_cmd_bison = BISON   $@
 64 quiet_cmd_test  = TEST    $@                       64 quiet_cmd_test  = TEST    $@
 65                                                    65 
 66 # Create directory unless it exists                66 # Create directory unless it exists
 67 quiet_cmd_mkdir = MKDIR   $(dir $@)                67 quiet_cmd_mkdir = MKDIR   $(dir $@)
 68       cmd_mkdir = mkdir -p $(dir $@)               68       cmd_mkdir = mkdir -p $(dir $@)
 69      rule_mkdir = $(if $(wildcard $(dir $@)),,     69      rule_mkdir = $(if $(wildcard $(dir $@)),,@$(call echo-cmd,mkdir) $(cmd_mkdir))
 70                                                    70 
 71 # Compile command                                  71 # Compile command
 72 quiet_cmd_cc_o_c = CC      $@                      72 quiet_cmd_cc_o_c = CC      $@
 73       cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $     73       cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
 74                                                    74 
 75 quiet_cmd_host_cc_o_c = HOSTCC  $@                 75 quiet_cmd_host_cc_o_c = HOSTCC  $@
 76       cmd_host_cc_o_c = $(HOSTCC) $(host_c_fla     76       cmd_host_cc_o_c = $(HOSTCC) $(host_c_flags) -c -o $@ $<
 77                                                    77 
 78 quiet_cmd_cxx_o_c = CXX     $@                     78 quiet_cmd_cxx_o_c = CXX     $@
 79       cmd_cxx_o_c = $(CXX) $(cxx_flags) -c -o      79       cmd_cxx_o_c = $(CXX) $(cxx_flags) -c -o $@ $<
 80                                                    80 
 81 quiet_cmd_cpp_i_c = CPP     $@                     81 quiet_cmd_cpp_i_c = CPP     $@
 82       cmd_cpp_i_c = $(CC) $(c_flags) -E -o $@      82       cmd_cpp_i_c = $(CC) $(c_flags) -E -o $@ $<
 83                                                    83 
 84 quiet_cmd_cc_s_c = AS      $@                      84 quiet_cmd_cc_s_c = AS      $@
 85       cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $     85       cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
 86                                                    86 
 87 quiet_cmd_gen = GEN     $@                         87 quiet_cmd_gen = GEN     $@
 88                                                    88 
 89 # Link agregate command                            89 # Link agregate command
 90 # If there's nothing to link, create empty $@      90 # If there's nothing to link, create empty $@ object.
 91 quiet_cmd_ld_multi = LD      $@                    91 quiet_cmd_ld_multi = LD      $@
 92       cmd_ld_multi = $(if $(strip $(obj-y)),\      92       cmd_ld_multi = $(if $(strip $(obj-y)),\
 93                      $(LD) -r -o $@  $(filter      93                      $(LD) -r -o $@  $(filter $(obj-y),$^),rm -f $@; $(AR) rcs $@)
 94                                                    94 
 95 quiet_cmd_host_ld_multi = HOSTLD  $@               95 quiet_cmd_host_ld_multi = HOSTLD  $@
 96       cmd_host_ld_multi = $(if $(strip $(obj-y     96       cmd_host_ld_multi = $(if $(strip $(obj-y)),\
 97                           $(HOSTLD) -r -o $@       97                           $(HOSTLD) -r -o $@  $(filter $(obj-y),$^),rm -f $@; $(HOSTAR) rcs $@)
 98                                                    98 
 99 ifneq ($(filter $(obj),$(hostprogs)),)             99 ifneq ($(filter $(obj),$(hostprogs)),)
100   host = host_                                    100   host = host_
101 endif                                             101 endif
102                                                   102 
103 # Build rules                                     103 # Build rules
104 $(OUTPUT)%.o: %.c FORCE                           104 $(OUTPUT)%.o: %.c FORCE
105         $(call rule_mkdir)                        105         $(call rule_mkdir)
106         $(call if_changed_dep,$(host)cc_o_c)      106         $(call if_changed_dep,$(host)cc_o_c)
107                                                   107 
108 $(OUTPUT)%.o: %.cpp FORCE                         108 $(OUTPUT)%.o: %.cpp FORCE
109         $(call rule_mkdir)                        109         $(call rule_mkdir)
110         $(call if_changed_dep,cxx_o_c)            110         $(call if_changed_dep,cxx_o_c)
111                                                   111 
112 $(OUTPUT)%.o: %.S FORCE                           112 $(OUTPUT)%.o: %.S FORCE
113         $(call rule_mkdir)                        113         $(call rule_mkdir)
114         $(call if_changed_dep,$(host)cc_o_c)      114         $(call if_changed_dep,$(host)cc_o_c)
115                                                   115 
116 $(OUTPUT)%.i: %.c FORCE                           116 $(OUTPUT)%.i: %.c FORCE
117         $(call rule_mkdir)                        117         $(call rule_mkdir)
118         $(call if_changed_dep,cpp_i_c)            118         $(call if_changed_dep,cpp_i_c)
119                                                   119 
120 $(OUTPUT)%.s: %.S FORCE                           120 $(OUTPUT)%.s: %.S FORCE
121         $(call rule_mkdir)                        121         $(call rule_mkdir)
122         $(call if_changed_dep,cpp_i_c)            122         $(call if_changed_dep,cpp_i_c)
123                                                   123 
124 $(OUTPUT)%.s: %.c FORCE                           124 $(OUTPUT)%.s: %.c FORCE
125         $(call rule_mkdir)                        125         $(call rule_mkdir)
126         $(call if_changed_dep,cc_s_c)             126         $(call if_changed_dep,cc_s_c)
127                                                   127 
128 # bison and flex files are generated in the OU    128 # bison and flex files are generated in the OUTPUT directory
129 # so it needs a separate rule to depend on the    129 # so it needs a separate rule to depend on them properly
130 $(OUTPUT)%-bison.o: $(OUTPUT)%-bison.c FORCE      130 $(OUTPUT)%-bison.o: $(OUTPUT)%-bison.c FORCE
131         $(call rule_mkdir)                        131         $(call rule_mkdir)
132         $(call if_changed_dep,$(host)cc_o_c)      132         $(call if_changed_dep,$(host)cc_o_c)
133                                                   133 
134 $(OUTPUT)%-flex.o: $(OUTPUT)%-flex.c FORCE        134 $(OUTPUT)%-flex.o: $(OUTPUT)%-flex.c FORCE
135         $(call rule_mkdir)                        135         $(call rule_mkdir)
136         $(call if_changed_dep,$(host)cc_o_c)      136         $(call if_changed_dep,$(host)cc_o_c)
137                                                   137 
138 # Gather build data:                              138 # Gather build data:
139 #   obj-y        - list of build objects          139 #   obj-y        - list of build objects
140 #   subdir-y     - list of directories to nest    140 #   subdir-y     - list of directories to nest
141 #   subdir-obj-y - list of directories objects    141 #   subdir-obj-y - list of directories objects 'dir/$(obj)-in.o'
142 obj-y        := $($(obj)-y)                       142 obj-y        := $($(obj)-y)
143 subdir-y     := $(patsubst %/,%,$(filter %/, $    143 subdir-y     := $(patsubst %/,%,$(filter %/, $(obj-y)))
144 obj-y        := $(patsubst %/, %/$(obj)-in.o,     144 obj-y        := $(patsubst %/, %/$(obj)-in.o, $(obj-y))
145 subdir-obj-y := $(filter %/$(obj)-in.o, $(obj-    145 subdir-obj-y := $(filter %/$(obj)-in.o, $(obj-y))
146                                                   146 
147 # '$(OUTPUT)/dir' prefix to all objects           147 # '$(OUTPUT)/dir' prefix to all objects
148 objprefix    := $(subst ./,,$(OUTPUT)$(dir)/)     148 objprefix    := $(subst ./,,$(OUTPUT)$(dir)/)
149 obj-y        := $(addprefix $(objprefix),$(obj    149 obj-y        := $(addprefix $(objprefix),$(obj-y))
150 subdir-obj-y := $(addprefix $(objprefix),$(sub    150 subdir-obj-y := $(addprefix $(objprefix),$(subdir-obj-y))
151                                                   151 
152 # Final '$(obj)-in.o' object                      152 # Final '$(obj)-in.o' object
153 in-target := $(objprefix)$(obj)-in.o              153 in-target := $(objprefix)$(obj)-in.o
154                                                   154 
155 PHONY += $(subdir-y)                              155 PHONY += $(subdir-y)
156                                                   156 
157 $(subdir-y):                                      157 $(subdir-y):
158         $(Q)$(MAKE) -f $(build-dir)/Makefile.b    158         $(Q)$(MAKE) -f $(build-dir)/Makefile.build dir=$(dir)/$@ obj=$(obj)
159                                                   159 
160 $(sort $(subdir-obj-y)): $(subdir-y) ;            160 $(sort $(subdir-obj-y)): $(subdir-y) ;
161                                                   161 
162 $(in-target): $(obj-y) FORCE                      162 $(in-target): $(obj-y) FORCE
163         $(call rule_mkdir)                        163         $(call rule_mkdir)
164         $(call if_changed,$(host)ld_multi)        164         $(call if_changed,$(host)ld_multi)
165                                                   165 
166 __build: $(in-target)                             166 __build: $(in-target)
167         @:                                        167         @:
168                                                   168 
169 PHONY += FORCE                                    169 PHONY += FORCE
170 FORCE:                                            170 FORCE:
171                                                   171 
172 # Include all cmd files to get all the depende    172 # Include all cmd files to get all the dependency rules
173 # for all objects included                        173 # for all objects included
174 targets   := $(wildcard $(sort $(obj-y) $(in-t    174 targets   := $(wildcard $(sort $(obj-y) $(in-target) $(MAKECMDGOALS)))
175 cmd_files := $(wildcard $(foreach f,$(targets)    175 cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
176                                                   176 
177 ifneq ($(cmd_files),)                             177 ifneq ($(cmd_files),)
178   include $(cmd_files)                            178   include $(cmd_files)
179 endif                                             179 endif
180                                                   180 
181 .PHONY: $(PHONY)                                  181 .PHONY: $(PHONY)
                                                      

~ [ 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