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 :=
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)
44 ifeq ($(need-modorder),)
45 ifneq ($(obj-m),)
46 $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
47 $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
53 # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
54 subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
55 subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
57 targets-for-builtin := $(extra-y)
59 ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
60 targets-for-builtin += $(obj)/lib.a
63 ifdef need-builtin
64 targets-for-builtin += $(obj)/built-in.a
67 targets-for-modules := $(foreach x, o mod, \
68 $(patsubst %.o, %.$x, $(filter %.o, $(obj-m))))
70 ifdef need-modorder
71 targets-for-modules += $(obj)/modules.order
74 targets += $(targets-for-builtin) $(targets-for-modules)
86 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $(KDOCFLAGS) \
87 $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
92 # ---------------------------------------------------------------------------
95 …cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) -fverbose-asm -S -o $…
101 cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
106 getexportsymbols = $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/$(1)/p'
109 $(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes)) \
110 $(if $(KBUILD_GENDWARFKSYMS_STABLE), --stable)
113 $(if $(KBUILD_SYMTYPES), -T $(@:.o=.symtypes)) \
114 $(if $(KBUILD_PRESERVE), -p) \
115 $(addprefix -r , $(wildcard $(@:.o=.symref)))
122 cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
128 cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $<
137 is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y)
150 if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then \
151 $(cmd_gensymtypes_$1) >> $(dot-target).cmd; \
162 RECORDMCOUNT_FLAGS = -w
165 # The empty.o file is created in the make process in order to determine
180 "$(if $(part-of-module),1,0)" "$(@)";
191 is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FI…
194 $(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-…
198 …ed_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple m…
201 # Built-in and composite module parts
208 cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
215 cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
223 # ---------------------------------------------------------------------------
227 # `--out-dir` is required to avoid temporaries being created by `rustc` in the
228 # current working directory, which may be not accessible in the out-of-tree
233 -Zallow-features=$(rust_allowed_features) \
234 -Zcrate-attr=no_std \
235 -Zcrate-attr='feature($(rust_allowed_features))' \
236 -Zunstable-options --extern pin_init --extern kernel \
237 --crate-type rlib -L $(objtree)/rust/ \
238 --crate-name $(basename $(notdir $@)) \
239 --sysroot=/dev/null \
240 --out-dir $(dir $@) --emit=dep-info=$(depfile)
242 # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
243 # will be used. We explicitly request `-Ccodegen-units=1` in any case, and
245 # requesting it explicitly and we start using some other `--emit` that does not
251 cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $< $(cmd_objtool)
263 $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
264 command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
270 cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
276 cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
282 cmd_rustc_rs_rs_S = $(CPP) $(c_flags) -xc -C -P $< | sed '1,/^\/\/ Cut here.$$/d' >$@
288 # ---------------------------------------------------------------------------
290 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
291 # or a file that it includes, in order to get versioned symbols. We build a
292 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
304 echo "\#include <asm/asm-prototypes.h>" ; \
310 $(CC) $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -; \
316 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
320 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
328 # we parse asm-prototypes.h C header to get function definitions.
337 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
338 targets += $(filter-out $(subdir-modorder), $(real-obj-m))
339 targets += $(lib-y) $(always-y)
341 # Linker scripts preprocessor (.lds.S -> .lds)
342 # ---------------------------------------------------------------------------
344 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
345 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
351 # ---------------------------------------------------------------------------
359 # Build the compiled-in targets
360 # ---------------------------------------------------------------------------
363 $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
364 $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
373 cmd_ar_builtin = rm -f $@; \
374 $(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
377 $(obj)/built-in.a: $(real-obj-y) FORCE
381 # sub-directories. The timestamp should be updated when any of the member files.
383 cmd_gen_order = { $(foreach m, $(real-prereqs), \
384 $(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \
387 $(obj)/modules.order: $(obj-m) FORCE
394 $(obj)/lib.a: $(lib-y) FORCE
398 cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$< $(cmd_objtool)
405 $(multi-obj-m): private objtool-enabled := $(delay-objtool)
406 $(multi-obj-m): private part-of-module := y
407 $(multi-obj-m): %.o: %.mod FORCE
409 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
416 $(filter %$(strip $(1)), $(targets))))
417 # %.asn1.o <- %.asn1.[ch] <- %.asn1
421 # ---------------------------------------------------------------------------
435 ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
440 # ---------------------------------------------------------------------------
442 $(obj)/: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \
443 $(if $(KBUILD_MODULES), $(targets-for-modules)) \
444 $(subdir-ym) $(always-y)
448 # ---------------------------------------------------------------------------
450 single-subdirs := $(foreach d, $(subdir-ym), $(if $(filter $d/%, $(MAKECMDGOALS)), $d))
451 single-subdir-goals := $(filter $(addsuffix /%, $(single-subdirs)), $(MAKECMDGOALS))
453 $(single-subdir-goals): $(single-subdirs)
457 # ---------------------------------------------------------------------------
459 PHONY += $(subdir-ym)
460 $(subdir-ym):
462 need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
463 need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) \
464 $(filter $@/%, $(single-subdir-goals))
467 # ---------------------------------------------------------------------------
473 targets += $(filter-out $(single-subdir-goals), $(MAKECMDGOALS))
474 targets := $(filter-out $(PHONY), $(targets))
481 existing-targets := $(wildcard $(sort $(targets)))
483 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
486 obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets))))
488 existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
489 obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
490 ifneq ($(obj-dirs),)
491 $(shell mkdir -p $(obj-dirs))