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 :=
19 always-y :=
20 always-m :=
22 subdir-y :=
23 subdir-m :=
28 asflags-y :=
29 ccflags-y :=
30 cppflags-y :=
31 ldflags-y :=
33 subdir-asflags-y :=
34 subdir-ccflags-y :=
37 -include include/config/auto.conf
42 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
43 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
44 include $(kbuild-file)
66 ifeq ($(need-modorder),)
67 ifneq ($(obj-m),)
68 $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
69 $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
75 # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
76 subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
77 subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
79 targets-for-builtin := $(extra-y)
81 ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
82 targets-for-builtin += $(obj)/lib.a
85 ifdef need-builtin
86 targets-for-builtin += $(obj)/built-in.a
89 targets-for-modules := $(patsubst %.o, %.mod, $(filter %.o, $(obj-m)))
91 ifdef need-modorder
92 targets-for-modules += $(obj)/modules.order
95 targets += $(targets-for-builtin) $(targets-for-modules)
107 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
111 # ---------------------------------------------------------------------------
114 cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) -fverbose-asm -S -o $@ $<
120 cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
127 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
128 scripts/genksyms/genksyms $(if $(1), -T $(2)) \
129 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
130 $(if $(KBUILD_PRESERVE),-p) \
131 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
136 test -s $@ || rm -f $@
144 cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
154 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
170 if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \
174 $(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \
175 -T $(@D)/.tmp_$(@F:.o=.ver); \
176 mv -f $(@D)/.tmp_$(@F) $@; \
177 rm -f $(@D)/.tmp_$(@F:.o=.ver); \
186 RECORDMCOUNT_FLAGS = -w
189 # The empty.o file is created in the make process in order to determine
204 "$(if $(part-of-module),1,0)" "$(@)";
219 objtool_args += $(if $(part-of-module), --module,)
222 objtool_args += --no-fp
225 objtool_args += --no-unreachable
228 objtool_args += --retpoline
231 objtool_args += --uaccess
254 $(CONFIG_SHELL) $(srctree)/scripts/gen_ksymdeps.sh $@ >> $(dot-target).cmd
277 # Built-in and composite module parts
283 …echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)…
291 cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
299 # ---------------------------------------------------------------------------
301 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
302 # or a file that it includes, in order to get versioned symbols. We build a
303 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
314 echo "\#include <asm/asm-prototypes.h>" ; \
317 … sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
318 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
319 scripts/genksyms/genksyms $(if $(1), -T $(2)) \
320 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
321 $(if $(KBUILD_PRESERVE),-p) \
322 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
327 test -s $@ || rm -f $@
334 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
340 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
345 # we parse asm-prototypes.h C header to get function definitions.
348 if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \
352 $(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \
353 -T $(@D)/.tmp_$(@F:.o=.ver); \
354 mv -f $(@D)/.tmp_$(@F) $@; \
355 rm -f $(@D)/.tmp_$(@F:.o=.ver); \
362 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
363 targets += $(filter-out $(subdir-modorder), $(real-obj-m))
364 targets += $(lib-y) $(always-y) $(MAKECMDGOALS)
366 # Linker scripts preprocessor (.lds.S -> .lds)
367 # ---------------------------------------------------------------------------
369 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
370 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
376 # ---------------------------------------------------------------------------
384 # Build the compiled-in targets
385 # ---------------------------------------------------------------------------
388 $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
389 $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
396 cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
398 $(obj)/built-in.a: $(real-obj-y) FORCE
402 # Rule to create modules.order file
404 # Create commands to either record .ko file or cat modules.order from
406 # Add $(obj-m) as the prerequisite to avoid updating the timestamp of
407 # modules.order unless contained modules are updated.
409 cmd_modules_order = { $(foreach m, $(real-prereqs), \
410 $(if $(filter %/modules.order, $m), cat $m, echo $(patsubst %.o,%.ko,$m));) :; } \
411 | $(AWK) '!x[$$0]++' - > $@
413 $(obj)/modules.order: $(obj-m) FORCE
419 $(obj)/lib.a: $(lib-y) FORCE
423 # Do not replace $(filter %.o,^) with $(real-prereqs). When a single object
426 quiet_cmd_link_multi-m = LD [M] $@
427 cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^)
429 $(multi-used-m): FORCE
430 $(call if_changed,link_multi-m)
431 $(call multi_depend, $(multi-used-m), .o, -objs -y -m)
433 targets += $(multi-used-m)
434 targets := $(filter-out $(PHONY), $(targets))
441 $(filter %$(strip $(1)), $(targets))))
442 # %.asn1.o <- %.asn1.[ch] <- %.asn1
443 # %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
444 # %.lex.o <- %.lex.c <- %.l
445 # %.tab.o <- %.tab.[ch] <- %.y
452 # ---------------------------------------------------------------------------
454 ifdef single-build
456 KBUILD_SINGLE_TARGETS := $(filter $(obj)/%, $(KBUILD_SINGLE_TARGETS))
458 curdir-single := $(sort $(foreach x, $(KBUILD_SINGLE_TARGETS), \
459 $(if $(filter $(x) $(basename $(x)).o, $(targets)), $(x))))
463 unknown-single := $(filter-out $(addsuffix /%, $(subdir-ym)), \
464 $(filter-out $(curdir-single), $(KBUILD_SINGLE_TARGETS)))
466 single-subdirs := $(foreach d, $(subdir-ym), \
467 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
469 __build: $(curdir-single) $(single-subdirs)
470 ifneq ($(unknown-single),)
471 $(Q)$(MAKE) -f /dev/null $(unknown-single)
475 ifeq ($(curdir-single),)
476 # Nothing to do in this directory. Do not include any .*.cmd file for speed-up
479 targets += $(curdir-single)
484 __build: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \
485 $(if $(KBUILD_MODULES), $(targets-for-modules)) \
486 $(subdir-ym) $(always-y)
492 # ---------------------------------------------------------------------------
494 PHONY += $(subdir-ym)
495 $(subdir-ym):
497 $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \
498 need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
499 need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1)
502 # ---------------------------------------------------------------------------
513 existing-targets := $(wildcard $(sort $(targets)))
515 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
518 obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets))))
520 existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
521 obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
522 ifneq ($(obj-dirs),)
523 $(shell mkdir -p $(obj-dirs))