Makefile.lib (d7c6ea024c08bbdb799768f51ffd9fdd6236d190) Makefile.lib (2f7ab1267dc9b2d1f29695aff3211c87483480f3)
1# SPDX-License-Identifier: GPL-2.0
2# Backward compatibility
3asflags-y += $(EXTRA_AFLAGS)
4ccflags-y += $(EXTRA_CFLAGS)
5cppflags-y += $(EXTRA_CPPFLAGS)
6ldflags-y += $(EXTRA_LDFLAGS)
7
8# flags that take effect in current and sub directories
9KBUILD_AFLAGS += $(subdir-asflags-y)
10KBUILD_CFLAGS += $(subdir-ccflags-y)
1# SPDX-License-Identifier: GPL-2.0
2# Backward compatibility
3asflags-y += $(EXTRA_AFLAGS)
4ccflags-y += $(EXTRA_CFLAGS)
5cppflags-y += $(EXTRA_CPPFLAGS)
6ldflags-y += $(EXTRA_LDFLAGS)
7
8# flags that take effect in current and sub directories
9KBUILD_AFLAGS += $(subdir-asflags-y)
10KBUILD_CFLAGS += $(subdir-ccflags-y)
11KBUILD_RUSTFLAGS += $(subdir-rustflags-y)
11
12# Figure out what we need to build from the various variables
13# ===========================================================================
14
15# When an object is listed to be built compiled-in and modular,
16# only build the compiled-in version
17obj-m := $(filter-out $(obj-y),$(obj-m))
18

--- 104 unchanged lines hidden (view full) ---

123modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) \
124 -D__KBUILD_MODNAME=kmod_$(call name-fix-token,$(modname))
125modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile))
126
127_c_flags = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
128 $(filter-out $(ccflags-remove-y), \
129 $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ccflags-y)) \
130 $(CFLAGS_$(target-stem).o))
12
13# Figure out what we need to build from the various variables
14# ===========================================================================
15
16# When an object is listed to be built compiled-in and modular,
17# only build the compiled-in version
18obj-m := $(filter-out $(obj-y),$(obj-m))
19

--- 104 unchanged lines hidden (view full) ---

124modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) \
125 -D__KBUILD_MODNAME=kmod_$(call name-fix-token,$(modname))
126modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile))
127
128_c_flags = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
129 $(filter-out $(ccflags-remove-y), \
130 $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ccflags-y)) \
131 $(CFLAGS_$(target-stem).o))
132_rust_flags = $(filter-out $(RUSTFLAGS_REMOVE_$(target-stem).o), \
133 $(filter-out $(rustflags-remove-y), \
134 $(KBUILD_RUSTFLAGS) $(rustflags-y)) \
135 $(RUSTFLAGS_$(target-stem).o))
131_a_flags = $(filter-out $(AFLAGS_REMOVE_$(target-stem).o), \
132 $(filter-out $(asflags-remove-y), \
133 $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(asflags-y)) \
134 $(AFLAGS_$(target-stem).o))
135_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds)
136
137#
138# Enable gcov profiling flags for a file, directory or for all files depending

--- 58 unchanged lines hidden (view full) ---

197part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
198quiet_modtag = $(if $(part-of-module),[M], )
199
200modkern_cflags = \
201 $(if $(part-of-module), \
202 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
203 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL) $(modfile_flags))
204
136_a_flags = $(filter-out $(AFLAGS_REMOVE_$(target-stem).o), \
137 $(filter-out $(asflags-remove-y), \
138 $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(asflags-y)) \
139 $(AFLAGS_$(target-stem).o))
140_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds)
141
142#
143# Enable gcov profiling flags for a file, directory or for all files depending

--- 58 unchanged lines hidden (view full) ---

202part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
203quiet_modtag = $(if $(part-of-module),[M], )
204
205modkern_cflags = \
206 $(if $(part-of-module), \
207 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
208 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL) $(modfile_flags))
209
210modkern_rustflags = \
211 $(if $(part-of-module), \
212 $(KBUILD_RUSTFLAGS_MODULE) $(RUSTFLAGS_MODULE), \
213 $(KBUILD_RUSTFLAGS_KERNEL) $(RUSTFLAGS_KERNEL))
214
205modkern_aflags = $(if $(part-of-module), \
206 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
207 $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
208
209c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
210 -include $(srctree)/include/linux/compiler_types.h \
211 $(_c_flags) $(modkern_cflags) \
212 $(basename_flags) $(modname_flags)
213
215modkern_aflags = $(if $(part-of-module), \
216 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
217 $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
218
219c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
220 -include $(srctree)/include/linux/compiler_types.h \
221 $(_c_flags) $(modkern_cflags) \
222 $(basename_flags) $(modname_flags)
223
224rust_flags = $(_rust_flags) $(modkern_rustflags) @$(objtree)/include/generated/rustc_cfg
225
214a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
215 $(_a_flags) $(modkern_aflags)
216
217cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
218 $(_cpp_flags)
219
220ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
221

--- 144 unchanged lines hidden (view full) ---

366$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
367
368ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
369DT_CHECKER ?= dt-validate
370DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
371DT_BINDING_DIR := Documentation/devicetree/bindings
372DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
373
226a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
227 $(_a_flags) $(modkern_aflags)
228
229cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
230 $(_cpp_flags)
231
232ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
233

--- 144 unchanged lines hidden (view full) ---

378$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
379
380ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
381DT_CHECKER ?= dt-validate
382DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
383DT_BINDING_DIR := Documentation/devicetree/bindings
384DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
385
374quiet_cmd_dtb = DTC_CHK $@
375 cmd_dtb = $(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
376else
377quiet_cmd_dtb = $(quiet_cmd_dtc)
378 cmd_dtb = $(cmd_dtc)
386quiet_cmd_dtb_check = CHECK $@
387 cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
379endif
380
388endif
389
390define rule_dtc
391 $(call cmd_and_fixdep,dtc)
392 $(call cmd,dtb_check)
393endef
394
381$(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
395$(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
382 $(call if_changed_dep,dtb)
396 $(call if_changed_rule,dtc)
383
384$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
385 $(call if_changed_dep,dtc)
386
387dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
388
389# Bzip2
390# ---------------------------------------------------------------------------

--- 152 unchanged lines hidden ---
397
398$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
399 $(call if_changed_dep,dtc)
400
401dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
402
403# Bzip2
404# ---------------------------------------------------------------------------

--- 152 unchanged lines hidden ---