Lines Matching +full:multi +full:-
2 # SPDX-License-Identifier: GPL-2.0
5 asflags-y += $(EXTRA_AFLAGS)
6 ccflags-y += $(EXTRA_CFLAGS)
7 cppflags-y += $(EXTRA_CPPFLAGS)
8 ldflags-y += $(EXTRA_LDFLAGS)
12 export KBUILD_SUBDIR_ASFLAGS := $(KBUILD_SUBDIR_ASFLAGS) $(subdir-asflags-y)
13 export KBUILD_SUBDIR_CCFLAGS := $(KBUILD_SUBDIR_CCFLAGS) $(subdir-ccflags-y)
18 # When an object is listed to be built compiled-in and modular,
19 # only build the compiled-in version
21 obj-m := $(filter-out $(obj-y),$(obj-m))
24 # Filter out objects already built-in
26 lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
30 # ---------------------------------------------------------------------------
31 # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o
32 # and add the directory to the list of dirs to descend into: $(subdir-y)
33 # o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
34 # and add the directory to the list of dirs to descend into: $(subdir-m)
37 # Unfortunately, we don't have information about ordering between -y
38 # and -m subdirs. Just put -y's first.
39 modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
41 __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
42 subdir-y += $(__subdir-y)
43 __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
44 subdir-m += $(__subdir-m)
45 obj-y := $(patsubst %/, %/built-in.o, $(obj-y))
46 obj-m := $(filter-out %/, $(obj-m))
50 subdir-ym := $(sort $(subdir-y) $(subdir-m))
52 # if $(foo-objs) exists, foo.o is a composite object
53 multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
54 multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
55 multi-used := $(multi-used-y) $(multi-used-m)
56 single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
60 multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
61 multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
62 multi-objs := $(multi-objs-y) $(multi-objs-m)
64 # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
66 subdir-obj-y := $(filter %/built-in.o, $(obj-y))
68 # $(obj-dirs) is a list of directories that contain object files
69 obj-dirs := $(dir $(multi-objs) $(obj-y))
71 # Replace multi-part objects by their individual parts, look at local dir only
72 …-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($…
73 real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs))…
77 extra-y := $(addprefix $(obj)/,$(extra-y))
81 obj-y := $(addprefix $(obj)/,$(obj-y))
82 obj-m := $(addprefix $(obj)/,$(obj-m))
83 lib-y := $(addprefix $(obj)/,$(lib-y))
84 subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
85 real-objs-y := $(addprefix $(obj)/,$(real-objs-y))
86 real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
87 single-used-m := $(addprefix $(obj)/,$(single-used-m))
88 multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
89 multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
90 multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
91 multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
92 subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
93 obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
100 # KBUILD_MODNAME definition. The reason is that any made-up name would
102 name-fix = $(subst $(comma),_,$(subst -,_,$1))
103 basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
105 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
108 $(ccflags-y) $(CFLAGS_$(basetarget).o)
109 _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
111 $(asflags-y) $(AFLAGS_$(basetarget).o)
112 _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags))
113 _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
137 # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
145 # -I$(obj) locates generated .h files
146 # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
149 __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags)
154 # Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE
155 c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
157 -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
159 a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
162 cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
165 ld_flags = $(LDFLAGS) $(ldflags-y)
167 # Try these files in order to find the U-Boot-specific .dtsi include file
168 u_boot_dtsi_options = $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
169 $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
170 $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
171 $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
172 $(wildcard $(dir $<)u-boot.dtsi)
180 # Modified for U-Boot
181 dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
182 -I$(srctree)/arch/$(ARCH)/dts \
183 -I$(srctree)/arch/$(ARCH)/dts/include \
184 -Iinclude \
185 -I$(srctree)/include \
186 -I$(srctree)/arch/$(ARCH)/include \
187 -include $(srctree)/include/linux/kconfig.h \
188 -D__ASSEMBLY__ \
189 -undef -D__DTS__
191 # Finds the multi-part object the current object will be linked into
192 modname-multi = $(sort $(foreach m,$(multi-used),\
193 $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
207 # ---------------------------------------------------------------------------
209 cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
216 # ---------------------------------------------------------------------------
220 cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $<
227 # ---------------------------------------------------------------------------
231 cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $<
238 cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $<
263 # and add target to extra-y so that we know we have to
267 # ---------------------------------------------------------------------------
270 cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \
271 $(filter-out FORCE,$^) -o $@
274 # ---------------------------------------------------------------------------
280 # ---------------------------------------------------------------------------
283 cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
284 (rm -f $@ ; false)
287 # ---------------------------------------------------------------------------
291 # Modified for U-Boot
296 echo '.global __dtb_$(subst -,_,$(*F))_begin'; \
297 echo '__dtb_$(subst -,_,$(*F))_begin:'; \
299 echo '__dtb_$(subst -,_,$(*F))_end:'; \
300 echo '.global __dtb_$(subst -,_,$(*F))_end'; \
308 # Modified for U-Boot
309 # Bring in any U-Boot-specific include at the end of the file
310 cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
311 (cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \
312 $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
313 $(DTC) -O dtb -o $@ -b 0 \
314 -i $(dir $<) $(DTC_FLAGS) \
315 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
321 pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
322 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
325 # ---------------------------------------------------------------------------
328 # Rule for objects only; does not put specific u-boot include at the end
330 # Modified for U-Boot
331 cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
332 $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \
333 $(DTC) -@ -O dtb -o $@ -b 0 \
334 -i $(dir $<) $(DTC_FLAGS) \
335 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
342 # ---------------------------------------------------------------------------
346 # Modified for U-Boot
363 # ---------------------------------------------------------------------------
382 cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j \
383 .dynamic -j .dynsym -j .rel* -j .rela* -j .reloc \
384 $(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@
390 cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
391 -Bsymbolic $^ -o $@
400 # ---------------------------------------------------------------------------
403 $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \
404 iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
411 # ---------------------------------------------------------------------------
414 # append the size as a 32-bit littleendian number as gzip does.
418 fsize=$$(stat -c "%s" $$F); \
431 cmd_bzip2 = (cat $(filter-out FORCE,$^) | \
432 bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
433 (rm -f $@ ; false)
436 # ---------------------------------------------------------------------------
439 cmd_lzma = (cat $(filter-out FORCE,$^) | \
440 lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
441 (rm -f $@ ; false)
444 cmd_lzo = (cat $(filter-out FORCE,$^) | \
445 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
446 (rm -f $@ ; false)
449 cmd_lz4 = (cat $(filter-out FORCE,$^) | \
450 lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
451 (rm -f $@ ; false)
453 # U-Boot mkimage
454 # ---------------------------------------------------------------------------
462 UIMAGE_OPTS-y ?=
466 UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)'
471 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \
472 -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \
473 -T $(UIMAGE_TYPE) \
474 -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \
475 -n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT)
478 # ---------------------------------------------------------------------------
492 # big dictionary would increase the memory usage too much in the multi-call
495 cmd_xzkern = (cat $(filter-out FORCE,$^) | \
497 $(call size_append, $(filter-out FORCE,$^))) > $@ || \
498 (rm -f $@ ; false)
501 cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
502 xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
503 (rm -f $@ ; false)
505 # Additional commands for U-Boot
508 # ---------------------------------------------------------------------------
511 cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \