Lines Matching +full:dtbs +full:- +full:check
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 :=
23 asflags-y :=
24 ccflags-y :=
25 rustflags-y :=
26 cppflags-y :=
27 ldflags-y :=
29 subdir-asflags-y :=
30 subdir-ccflags-y :=
33 -include $(objtree)/include/config/auto.conf
37 include $(kbuild-file)
41 KBUILD_AFLAGS += $(subdir-asflags-y)
42 KBUILD_CFLAGS += $(subdir-ccflags-y)
43 KBUILD_RUSTFLAGS += $(subdir-rustflags-y)
48 # When an object is listed to be built compiled-in and modular,
49 # only build the compiled-in version
50 obj-m := $(filter-out $(obj-y),$(obj-m))
53 # Filter out objects already built-in
54 lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
57 subdir-ym := $(sort $(subdir-y) $(subdir-m) \
58 $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-m))))
61 # - If we encounter foo/ in $(obj-y), replace it by foo/built-in.a and
63 # - If we encounter foo/ in $(obj-m), replace it by foo/modules.order
66 # information about ordering between -y and -m subdirs. Just put -y's first.
68 ifdef need-modorder
69 obj-m := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m))
71 obj-m := $(filter-out %/, $(obj-m))
74 ifdef need-builtin
75 obj-y := $(patsubst %/, %/built-in.a, $(obj-y))
77 obj-y := $(filter-out %/, $(obj-y))
80 # Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
81 suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
83 multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $m)))
85 real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $(call suffix-search, $m, …
87 # If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
88 multi-obj-y := $(call multi-search, $(obj-y), .o, -objs -y)
89 multi-obj-m := $(call multi-search, $(obj-m), .o, -objs -y -m)
90 multi-obj-ym := $(multi-obj-y) $(multi-obj-m)
92 # Replace multi-part objects by their individual parts,
93 # including built-in.a from subdirectories
94 real-obj-y := $(call real-search, $(obj-y), .o, -objs -y)
95 real-obj-m := $(call real-search, $(obj-m), .o, -objs -y -m)
97 always-y += $(always-m)
99 # hostprogs-always-y += foo
102 # always-y += foo
103 hostprogs += $(hostprogs-always-y) $(hostprogs-always-m)
104 always-y += $(hostprogs-always-y) $(hostprogs-always-m)
106 # userprogs-always-y is likewise.
107 userprogs += $(userprogs-always-y) $(userprogs-always-m)
108 always-y += $(userprogs-always-y) $(userprogs-always-m)
113 extra-y := $(addprefix $(obj)/, $(extra-y))
114 always-y := $(addprefix $(obj)/, $(always-y))
116 obj-m := $(addprefix $(obj)/, $(obj-m))
117 lib-y := $(addprefix $(obj)/, $(lib-y))
118 real-obj-y := $(addprefix $(obj)/, $(real-obj-y))
119 real-obj-m := $(addprefix $(obj)/, $(real-obj-m))
120 multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
121 subdir-ym := $(addprefix $(obj)/, $(subdir-ym))
128 ifeq ($(need-modorder),)
129 ifneq ($(obj-m),)
130 $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
131 $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
137 # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
138 subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
139 subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
141 targets-for-builtin := $(extra-y)
143 ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
144 targets-for-builtin += $(obj)/lib.a
147 ifdef need-builtin
148 targets-for-builtin += $(obj)/built-in.a
151 targets-for-modules := $(foreach x, o mod, \
152 $(patsubst %.o, %.$x, $(filter %.o, $(obj-m))))
154 ifdef need-modorder
155 targets-for-modules += $(obj)/modules.order
158 targets += $(targets-for-builtin) $(targets-for-modules)
162 quiet_cmd_checksrc = CHECK $<
163 cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
165 quiet_cmd_force_checksrc = CHECK $<
166 cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
170 cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(KDOCFLAGS) \
171 $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
176 # ---------------------------------------------------------------------------
179 …cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) -fverbose-asm -S -o $…
185 cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
190 getexportsymbols = $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/$(1)/p'
193 $(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes)) \
194 $(if $(KBUILD_GENDWARFKSYMS_STABLE), --stable)
197 $(if $(KBUILD_SYMTYPES), -T $(@:.o=.symtypes)) \
198 $(if $(KBUILD_PRESERVE), -p) \
199 $(addprefix -r , $(wildcard $(@:.o=.symref)))
206 cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
212 cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $<
221 is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y)
234 if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then \
235 $(cmd_gensymtypes_$1) >> $(dot-target).cmd; \
246 RECORDMCOUNT_FLAGS = -w
264 "$(if $(part-of-module),1,0)" "$(@)";
275 is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FI…
278 $(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-…
282 …ed_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple m…
285 # Built-in and composite module parts
292 cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
299 cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
307 # ---------------------------------------------------------------------------
309 # The features in this list are the ones allowed for non-`rust/` code.
311 # - Stable since Rust 1.81.0: `feature(lint_reasons)`.
312 # - Stable since Rust 1.82.0: `feature(asm_const)`,
314 # - Stable since Rust 1.87.0: `feature(asm_goto)`.
315 # - Expected to become stable: `feature(arbitrary_self_types)`.
316 # - To be determined: `feature(used_with_arg)`.
318 # Please see https://github.com/Rust-for-Linux/linux/issues/2 for details on
322 # `--out-dir` is required to avoid temporaries being created by `rustc` in the
323 # current working directory, which may be not accessible in the out-of-tree
328 -Zallow-features=$(rust_allowed_features) \
329 -Zcrate-attr=no_std \
330 -Zcrate-attr='feature($(rust_allowed_features))' \
331 -Zunstable-options --extern pin_init --extern kernel \
332 --crate-type rlib -L $(objtree)/rust/ \
333 --crate-name $(basename $(notdir $@)) \
334 --sysroot=/dev/null \
335 --out-dir $(dir $@) --emit=dep-info=$(depfile)
337 # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
338 # will be used. We explicitly request `-Ccodegen-units=1` in any case, and
340 # requesting it explicitly and we start using some other `--emit` that does not
346 cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $< $(cmd_objtool)
358 $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
359 command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
365 cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
371 cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
377 cmd_rustc_rs_rs_S = $(CPP) $(c_flags) -xc -C -P $< | sed '1,/^\/\/ Cut here.$$/d' >$@
383 # ---------------------------------------------------------------------------
385 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
387 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
399 echo "\#include <asm/asm-prototypes.h>" ; \
405 $(CC) $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -; \
411 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
415 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
423 # we parse asm-prototypes.h C header to get function definitions.
432 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
433 targets += $(filter-out $(subdir-modorder), $(real-obj-m))
434 targets += $(lib-y) $(always-y)
436 # Linker scripts preprocessor (.lds.S -> .lds)
437 # ---------------------------------------------------------------------------
439 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
440 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
446 # ---------------------------------------------------------------------------
454 # Build the compiled-in targets
455 # ---------------------------------------------------------------------------
458 $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
459 $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
468 cmd_ar_builtin = rm -f $@; \
469 $(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
472 $(obj)/built-in.a: $(real-obj-y) FORCE
476 # sub-directories. The timestamp should be updated when any of the member files.
478 cmd_gen_order = { $(foreach m, $(real-prereqs), \
482 $(obj)/modules.order: $(obj-m) FORCE
489 $(obj)/lib.a: $(lib-y) FORCE
493 cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$< $(cmd_objtool)
500 $(multi-obj-m): private objtool-enabled := $(delay-objtool)
501 $(multi-obj-m): private part-of-module := y
502 $(multi-obj-m): %.o: %.mod FORCE
504 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
512 # %.asn1.o <- %.asn1.[ch] <- %.asn1
516 # ---------------------------------------------------------------------------
530 ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
531 include $(srctree)/scripts/Makefile.dtbs
535 # ---------------------------------------------------------------------------
537 $(obj)/: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \
538 $(if $(KBUILD_MODULES), $(targets-for-modules)) \
539 $(subdir-ym) $(always-y)
543 # ---------------------------------------------------------------------------
545 single-subdirs := $(foreach d, $(subdir-ym), $(if $(filter $d/%, $(MAKECMDGOALS)), $d))
546 single-subdir-goals := $(filter $(addsuffix /%, $(single-subdirs)), $(MAKECMDGOALS))
548 $(single-subdir-goals): $(single-subdirs)
552 # ---------------------------------------------------------------------------
554 PHONY += $(subdir-ym)
555 $(subdir-ym):
557 need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
558 need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) \
559 $(filter $@/%, $(single-subdir-goals))
562 # ---------------------------------------------------------------------------
568 targets += $(filter-out $(single-subdir-goals), $(MAKECMDGOALS))
569 targets := $(filter-out $(PHONY), $(targets))
576 existing-targets := $(wildcard $(sort $(targets)))
578 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
581 obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets))))
583 existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
584 obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
585 ifneq ($(obj-dirs),)
586 $(shell mkdir -p $(obj-dirs))