Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: use $(obj)/ instead of $(src)/ for common pattern rules

Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
checked-in source files. It is merely a convention without any functional
difference. In fact, $(obj) and $(src) are exactly the same, as defined
in scripts/Makefile.build:

src := $(obj)

Before changing the semantics of $(src) in the next commit, this commit
replaces $(obj)/ with $(src)/ in pattern rules where the prerequisite
might be a generated file.

C, assembly, Rust, and DTS files are sometimes generated by tools, so
they could be either generated files or real sources. The $(obj)/ prefix
works for both cases with the help of VPATH.

As mentioned above, $(obj) and $(src) are the same at this point, hence
this commit has no functional change.

I did not modify scripts/Makefile.userprogs because there is no use
case where userspace C files are generated.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

+16 -16
+13 -13
scripts/Makefile.build
··· 113 113 quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ 114 114 cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) -fverbose-asm -S -o $@ $< 115 115 116 - $(obj)/%.s: $(src)/%.c FORCE 116 + $(obj)/%.s: $(obj)/%.c FORCE 117 117 $(call if_changed_dep,cc_s_c) 118 118 119 119 quiet_cmd_cpp_i_c = CPP $(quiet_modtag) $@ 120 120 cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $< 121 121 122 - $(obj)/%.i: $(src)/%.c FORCE 122 + $(obj)/%.i: $(obj)/%.c FORCE 123 123 $(call if_changed_dep,cpp_i_c) 124 124 125 125 genksyms = scripts/genksyms/genksyms \ ··· 133 133 quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ 134 134 cmd_cc_symtypes_c = $(call cmd_gensymtypes_c,true,$@) >/dev/null 135 135 136 - $(obj)/%.symtypes : $(src)/%.c FORCE 136 + $(obj)/%.symtypes : $(obj)/%.c FORCE 137 137 $(call cmd,cc_symtypes_c) 138 138 139 139 # LLVM assembly ··· 141 141 quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ 142 142 cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $< 143 143 144 - $(obj)/%.ll: $(src)/%.c FORCE 144 + $(obj)/%.ll: $(obj)/%.c FORCE 145 145 $(call if_changed_dep,cc_ll_c) 146 146 147 147 # C (.c) files ··· 240 240 endef 241 241 242 242 # Built-in and composite module parts 243 - $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE 243 + $(obj)/%.o: $(obj)/%.c $(recordmcount_source) FORCE 244 244 $(call if_changed_rule,cc_o_c) 245 245 $(call cmd,force_checksrc) 246 246 ··· 257 257 $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ 258 258 System.map $(OBJDUMP) > $@ 259 259 260 - $(obj)/%.lst: $(src)/%.c FORCE 260 + $(obj)/%.lst: $(obj)/%.c FORCE 261 261 $(call if_changed_dep,cc_lst_c) 262 262 263 263 # Compile Rust sources (.rs) ··· 290 290 quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ 291 291 cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $< 292 292 293 - $(obj)/%.o: $(src)/%.rs FORCE 293 + $(obj)/%.o: $(obj)/%.rs FORCE 294 294 +$(call if_changed_dep,rustc_o_rs) 295 295 296 296 quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ ··· 298 298 $(rust_common_cmd) -Zunpretty=expanded $< >$@; \ 299 299 command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@ 300 300 301 - $(obj)/%.rsi: $(src)/%.rs FORCE 301 + $(obj)/%.rsi: $(obj)/%.rs FORCE 302 302 +$(call if_changed_dep,rustc_rsi_rs) 303 303 304 304 quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ 305 305 cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $< 306 306 307 - $(obj)/%.s: $(src)/%.rs FORCE 307 + $(obj)/%.s: $(obj)/%.rs FORCE 308 308 +$(call if_changed_dep,rustc_s_rs) 309 309 310 310 quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ 311 311 cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $< 312 312 313 - $(obj)/%.ll: $(src)/%.rs FORCE 313 + $(obj)/%.ll: $(obj)/%.rs FORCE 314 314 +$(call if_changed_dep,rustc_ll_rs) 315 315 316 316 # Compile assembler sources (.S) ··· 336 336 quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@ 337 337 cmd_cc_symtypes_S = $(call cmd_gensymtypes_S,true,$@) >/dev/null 338 338 339 - $(obj)/%.symtypes : $(src)/%.S FORCE 339 + $(obj)/%.symtypes : $(obj)/%.S FORCE 340 340 $(call cmd,cc_symtypes_S) 341 341 342 342 343 343 quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@ 344 344 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $< 345 345 346 - $(obj)/%.s: $(src)/%.S FORCE 346 + $(obj)/%.s: $(obj)/%.S FORCE 347 347 $(call if_changed_dep,cpp_s_S) 348 348 349 349 quiet_cmd_as_o_S = AS $(quiet_modtag) $@ ··· 358 358 359 359 endif 360 360 361 - $(obj)/%.o: $(src)/%.S FORCE 361 + $(obj)/%.o: $(obj)/%.S FORCE 362 362 $(call if_changed_rule,as_o_S) 363 363 364 364 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
+2 -2
scripts/Makefile.host
··· 112 112 quiet_cmd_host-csingle = HOSTCC $@ 113 113 cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ 114 114 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) 115 - $(host-csingle): $(obj)/%: $(src)/%.c FORCE 115 + $(host-csingle): $(obj)/%: $(obj)/%.c FORCE 116 116 $(call if_changed_dep,host-csingle) 117 117 118 118 # Link an executable based on list of .o files, all plain c ··· 129 129 # host-cobjs -> .o 130 130 quiet_cmd_host-cobjs = HOSTCC $@ 131 131 cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< 132 - $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE 132 + $(host-cobjs): $(obj)/%.o: $(obj)/%.c FORCE 133 133 $(call if_changed_dep,host-cobjs) 134 134 135 135 # Link an executable based on list of .o files, a mixture of .c and .cc
+1 -1
scripts/Makefile.lib
··· 423 423 cmd_dtb = $(cmd_dtc) 424 424 endif 425 425 426 - $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE 426 + $(obj)/%.dtb: $(obj)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE 427 427 $(call if_changed_dep,dtb) 428 428 429 429 $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE