Lines Matching +full:multi +full:- +full:word

1 # SPDX-License-Identifier: GPL-2.0
14 obj-y :=
15 obj-m :=
16 lib-y :=
17 lib-m :=
18 always-y :=
19 always-m :=
21 subdir-y :=
22 subdir-m :=
27 asflags-y :=
28 ccflags-y :=
29 rustflags-y :=
30 cppflags-y :=
31 ldflags-y :=
33 subdir-asflags-y :=
34 subdir-ccflags-y :=
37 -include include/config/auto.conf
41 include $(kbuild-file)
48 ifeq ($(need-modorder),)
49 ifneq ($(obj-m),)
50 $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
51 $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
57 # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
58 subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
59 subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
61 targets-for-builtin := $(extra-y)
63 ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
64 targets-for-builtin += $(obj)/lib.a
67 ifdef need-builtin
68 targets-for-builtin += $(obj)/built-in.a
71 targets-for-modules := $(foreach x, o mod, \
72 $(patsubst %.o, %.$x, $(filter %.o, $(obj-m))))
74 ifdef need-modorder
75 targets-for-modules += $(obj)/modules.order
78 targets += $(targets-for-builtin) $(targets-for-modules)
90 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $(KDOCFLAGS) \
91 $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
96 # ---------------------------------------------------------------------------
99 …cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) -fverbose-asm -S -o $…
105 cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
111 $(if $(1), -T $(2)) \
112 $(if $(KBUILD_PRESERVE), -p) \
113 -r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null)
116 cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
127 cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $<
136 is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y)
141 cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-tar…
145 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< \
160 if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then \
162 >> $(dot-target).cmd; \
173 RECORDMCOUNT_FLAGS = -w
177 # the target endianness and word size. It is made before all other C
191 "$(if $(part-of-module),1,0)" "$(@)";
202 is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FI…
204 $(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-
207 …n_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to mult…
227 # Built-in and composite module parts
234 cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
241 cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
249 # ---------------------------------------------------------------------------
253 # `--out-dir` is required to avoid temporaries being created by `rustc` in the
254 # current working directory, which may be not accessible in the out-of-tree
258 -Zallow-features=$(rust_allowed_features) \
259 -Zcrate-attr=no_std \
260 -Zcrate-attr='feature($(rust_allowed_features))' \
261 -Zunstable-options --extern force:alloc --extern kernel \
262 --crate-type rlib -L $(objtree)/rust/ \
263 --crate-name $(basename $(notdir $@)) \
264 --sysroot=/dev/null \
265 --out-dir $(dir $@) --emit=dep-info=$(depfile)
267 # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
268 # will be used. We explicitly request `-Ccodegen-units=1` in any case, and
270 # requesting it explicitly and we start using some other `--emit` that does not
276 cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $< $(cmd_objtool)
288 $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
289 command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
295 cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
301 cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
307 # ---------------------------------------------------------------------------
309 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
311 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
322 echo "\#include <asm/asm-prototypes.h>" ; \
323 $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/EXPORT_SYMBOL(\1);/p' ; } | \
324 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
334 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
340 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool)
345 # we parse asm-prototypes.h C header to get function definitions.
354 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
355 targets += $(filter-out $(subdir-modorder), $(real-obj-m))
356 targets += $(lib-y) $(always-y)
358 # Linker scripts preprocessor (.lds.S -> .lds)
359 # ---------------------------------------------------------------------------
361 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
362 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
368 # ---------------------------------------------------------------------------
376 # Build the compiled-in targets
377 # ---------------------------------------------------------------------------
380 $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
381 $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
390 cmd_ar_builtin = rm -f $@; \
391 $(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
394 $(obj)/built-in.a: $(real-obj-y) FORCE
398 # sub-directories. The timestamp should be updated when any of the member files.
400 cmd_gen_order = { $(foreach m, $(real-prereqs), \
404 $(obj)/modules.order: $(obj-m) FORCE
411 $(obj)/lib.a: $(lib-y) FORCE
415 cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$< $(cmd_objtool)
422 $(multi-obj-m): private objtool-enabled := $(delay-objtool)
423 $(multi-obj-m): private part-of-module := y
424 $(multi-obj-m): %.o: %.mod FORCE
426 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
434 # %.asn1.o <- %.asn1.[ch] <- %.asn1
438 # ---------------------------------------------------------------------------
452 ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
457 # ---------------------------------------------------------------------------
459 $(obj)/: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \
460 $(if $(KBUILD_MODULES), $(targets-for-modules)) \
461 $(subdir-ym) $(always-y)
465 # ---------------------------------------------------------------------------
467 single-subdirs := $(foreach d, $(subdir-ym), $(if $(filter $d/%, $(MAKECMDGOALS)), $d))
468 single-subdir-goals := $(filter $(addsuffix /%, $(single-subdirs)), $(MAKECMDGOALS))
470 $(single-subdir-goals): $(single-subdirs)
474 # ---------------------------------------------------------------------------
476 PHONY += $(subdir-ym)
477 $(subdir-ym):
479 need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
480 need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) \
481 $(filter $@/%, $(single-subdir-goals))
484 # ---------------------------------------------------------------------------
490 targets += $(filter-out $(single-subdir-goals), $(MAKECMDGOALS))
491 targets := $(filter-out $(PHONY), $(targets))
498 existing-targets := $(wildcard $(sort $(targets)))
500 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
503 obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets))))
505 existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
506 obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
507 ifneq ($(obj-dirs),)
508 $(shell mkdir -p $(obj-dirs))