Lines Matching +full:filter +full:- +full:order
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)
62 ifeq ($(need-modorder),)
63 ifneq ($(obj-m),)
64 $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
65 $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
71 # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
72 subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
73 subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
75 targets-for-builtin := $(extra-y)
77 ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
78 targets-for-builtin += $(obj)/lib.a
81 ifdef need-builtin
82 targets-for-builtin += $(obj)/built-in.a
85 targets-for-modules := $(foreach x, o mod, \
86 $(patsubst %.o, %.$x, $(filter %.o, $(obj-m))))
88 ifdef need-modorder
89 targets-for-modules += $(obj)/modules.order
92 targets += $(targets-for-builtin) $(targets-for-modules)
104 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $(KDOCFLAGS) \
105 $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
110 # ---------------------------------------------------------------------------
113 …cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) -fverbose-asm -S -o $…
119 cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
125 $(if $(1), -T $(2)) \
126 $(if $(KBUILD_PRESERVE), -p) \
127 -r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null)
130 cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
141 cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $<
150 is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y)
155 cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-tar…
159 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< \
174 if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then \
176 >> $(dot-target).cmd; \
187 RECORDMCOUNT_FLAGS = -w
190 # The empty.o file is created in the make process in order to determine
205 "$(if $(part-of-module),1,0)" "$(@)";
216 is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FIL…
218 $(obj)/%.o: objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-obj-m),y…
221 …ed_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple m…
241 # Built-in and composite module parts
248 cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
255 cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
263 # ---------------------------------------------------------------------------
267 # `--out-dir` is required to avoid temporaries being created by `rustc` in the
268 # current working directory, which may be not accessible in the out-of-tree
272 -Zallow-features=$(rust_allowed_features) \
273 -Zcrate-attr=no_std \
274 -Zcrate-attr='feature($(rust_allowed_features))' \
275 --extern alloc --extern kernel \
276 --crate-type rlib -L $(objtree)/rust/ \
277 --crate-name $(basename $(notdir $@)) \
278 --sysroot=/dev/null \
279 --out-dir $(dir $@) --emit=dep-info=$(depfile)
281 # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
282 # will be used. We explicitly request `-Ccodegen-units=1` in any case, and
284 # requesting it explicitly and we start using some other `--emit` that does not
290 cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $<
297 $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
298 command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
304 cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
310 cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
316 # ---------------------------------------------------------------------------
318 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
319 # or a file that it includes, in order to get versioned symbols. We build a
320 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
331 echo "\#include <asm/asm-prototypes.h>" ; \
332 $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/EXPORT_SYMBOL(\1);/p' ; } | \
333 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
343 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
349 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool)
354 # we parse asm-prototypes.h C header to get function definitions.
363 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
364 targets += $(filter-out $(subdir-modorder), $(real-obj-m))
365 targets += $(real-dtb-y) $(lib-y) $(always-y)
367 # Linker scripts preprocessor (.lds.S -> .lds)
368 # ---------------------------------------------------------------------------
370 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
371 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
377 # ---------------------------------------------------------------------------
385 # Build the compiled-in targets
386 # ---------------------------------------------------------------------------
389 $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
390 $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
399 cmd_ar_builtin = rm -f $@; \
400 $(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
403 $(obj)/built-in.a: $(real-obj-y) FORCE
407 # Rule to create modules.order file
409 # Create commands to either record .ko file or cat modules.order from
411 # Add $(obj-m) as the prerequisite to avoid updating the timestamp of
412 # modules.order unless contained modules are updated.
414 cmd_modules_order = { $(foreach m, $(real-prereqs), \
415 $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \
418 $(obj)/modules.order: $(obj-m) FORCE
425 $(obj)/lib.a: $(lib-y) FORCE
429 cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$< $(cmd_objtool)
436 $(multi-obj-m): objtool-enabled := $(delay-objtool)
437 $(multi-obj-m): part-of-module := y
438 $(multi-obj-m): %.o: %.mod FORCE
440 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
447 $(filter %$(strip $(1)), $(targets))))
448 # %.asn1.o <- %.asn1.[ch] <- %.asn1
449 # %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
450 # %.dtbo.o <- %.dtbo.S <- %.dtbo <- %.dtso
451 # %.lex.o <- %.lex.c <- %.l
452 # %.tab.o <- %.tab.[ch] <- %.y
460 # ---------------------------------------------------------------------------
462 $(obj)/: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \
463 $(if $(KBUILD_MODULES), $(targets-for-modules)) \
464 $(subdir-ym) $(always-y)
468 # ---------------------------------------------------------------------------
470 single-subdirs := $(foreach d, $(subdir-ym), $(if $(filter $d/%, $(MAKECMDGOALS)), $d))
471 single-subdir-goals := $(filter $(addsuffix /%, $(single-subdirs)), $(MAKECMDGOALS))
473 $(single-subdir-goals): $(single-subdirs)
477 # ---------------------------------------------------------------------------
479 PHONY += $(subdir-ym)
480 $(subdir-ym):
482 need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
483 need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) \
484 $(filter $@/%, $(single-subdir-goals))
487 # ---------------------------------------------------------------------------
493 targets += $(filter-out $(single-subdir-goals), $(MAKECMDGOALS))
494 targets := $(filter-out $(PHONY), $(targets))
501 existing-targets := $(wildcard $(sort $(targets)))
503 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
506 obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets))))
508 existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
509 obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
510 ifneq ($(obj-dirs),)
511 $(shell mkdir -p $(obj-dirs))