Skip to content

Commit 129ab0d

Browse files
committed
kbuild: do not quote string values in include/config/auto.conf
The previous commit fixed up all shell scripts to not include include/config/auto.conf. Now that include/config/auto.conf is only included by Makefiles, we can change it into a more Make-friendly form. Previously, Kconfig output string values enclosed with double-quotes (both in the .config and include/config/auto.conf): CONFIG_X="foo bar" Unlike shell, Make handles double-quotes (and single-quotes as well) verbatim. We must rip them off when used. There are some patterns: [1] $(patsubst "%",%,$(CONFIG_X)) [2] $(CONFIG_X:"%"=%) [3] $(subst ",,$(CONFIG_X)) [4] $(shell echo $(CONFIG_X)) These are not only ugly, but also fragile. [1] and [2] do not work if the value contains spaces, like CONFIG_X=" foo bar " [3] does not work correctly if the value contains double-quotes like CONFIG_X="foo\"bar" [4] seems to work better, but has a cost of forking a process. Anyway, quoted strings were always PITA for our Makefiles. This commit changes Kconfig to stop quoting in include/config/auto.conf. These are the string type symbols referenced in Makefiles or scripts: ACPI_CUSTOM_DSDT_FILE ARC_BUILTIN_DTB_NAME ARC_TUNE_MCPU BUILTIN_DTB_SOURCE CC_IMPLICIT_FALLTHROUGH CC_VERSION_TEXT CFG80211_EXTRA_REGDB_KEYDIR EXTRA_FIRMWARE EXTRA_FIRMWARE_DIR EXTRA_TARGETS H8300_BUILTIN_DTB INITRAMFS_SOURCE LOCALVERSION MODULE_SIG_HASH MODULE_SIG_KEY NDS32_BUILTIN_DTB NIOS2_DTB_SOURCE OPENRISC_BUILTIN_DTB SOC_CANAAN_K210_DTB_SOURCE SYSTEM_BLACKLIST_HASH_LIST SYSTEM_REVOCATION_KEYS SYSTEM_TRUSTED_KEYS TARGET_CPU UNUSED_KSYMS_WHITELIST XILINX_MICROBLAZE0_FAMILY XILINX_MICROBLAZE0_HW_VER XTENSA_VARIANT_NAME I checked them one by one, and fixed up the code where necessary. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 7d15369 commit 129ab0d

File tree

23 files changed

+40
-66
lines changed

23 files changed

+40
-66
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,9 +1720,9 @@ PHONY += prepare
17201720
# now expand this into a simple variable to reduce the cost of shell evaluations
17211721
prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
17221722
prepare:
1723-
@if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then \
1723+
@if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ]; then \
17241724
echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
1725-
echo >&2 " The kernel was built by: "$(CONFIG_CC_VERSION_TEXT); \
1725+
echo >&2 " The kernel was built by: $(CONFIG_CC_VERSION_TEXT)"; \
17261726
echo >&2 " You are using: $(CC_VERSION_TEXT)"; \
17271727
fi
17281728

arch/arc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
1414
tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700
1515
tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
1616

17-
ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
17+
ifeq ($(CONFIG_ARC_TUNE_MCPU),)
1818
cflags-y += $(tune-mcpu-def-y)
1919
else
20-
tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
20+
tune-mcpu := $(CONFIG_ARC_TUNE_MCPU)
2121
ifneq ($(call cc-option,$(tune-mcpu)),)
2222
cflags-y += $(tune-mcpu)
2323
else

arch/arc/boot/dts/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Built-in dtb
33
builtindtb-y := nsim_700
44

5-
ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),"")
6-
builtindtb-y := $(patsubst "%",%,$(CONFIG_ARC_BUILTIN_DTB_NAME))
5+
ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),)
6+
builtindtb-y := $(CONFIG_ARC_BUILTIN_DTB_NAME)
77
endif
88

99
obj-y += $(builtindtb-y).dtb.o

arch/h8300/boot/dts/Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""'
3-
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_H8300_BUILTIN_DTB)).dtb.o
4-
endif
5-
6-
obj-y += $(BUILTIN_DTB)
2+
obj-y += $(addsuffix .dtb.o, $(CONFIG_H8300_BUILTIN_DTB))
73

84
dtb-$(CONFIG_H8300H_SIM) := h8300h_sim.dtb
95
dtb-$(CONFIG_H8S_SIM) := h8s_sim.dtb

arch/microblaze/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
55

66
# What CPU version are we building for, and crack it open
77
# as major.minor.rev
8-
CPU_VER := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER))
8+
CPU_VER := $(CONFIG_XILINX_MICROBLAZE0_HW_VER)
99
CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
1010
CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
1111
CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3)

arch/nds32/boot/dts/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
3-
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o
4-
else
5-
BUILTIN_DTB :=
6-
endif
7-
obj-$(CONFIG_OF) += $(BUILTIN_DTB)
2+
obj-$(CONFIG_OF) += $(addsuffix .dtb.o, $(CONFIG_NDS32_BUILTIN_DTB))

arch/nios2/boot/dts/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
obj-y := $(patsubst "%.dts",%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE))
3+
obj-y := $(patsubst %.dts,%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE))
44

55
dtstree := $(srctree)/$(src)
66
dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))

arch/openrisc/boot/dts/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""'
3-
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o
4-
else
5-
BUILTIN_DTB :=
6-
endif
7-
obj-y += $(BUILTIN_DTB)
2+
obj-y += $(addsuffix .dtb.o, $(CONFIG_OPENRISC_BUILTIN_DTB))
83

94
#DTC_FLAGS ?= -p 1024

arch/powerpc/boot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
365365
endif
366366

367367
# Allow extra targets to be added to the defconfig
368-
image-y += $(subst ",,$(CONFIG_EXTRA_TARGETS))
368+
image-y += $(CONFIG_EXTRA_TARGETS)
369369

370370
initrd- := $(patsubst zImage%, zImage.initrd%, $(image-))
371371
initrd-y := $(patsubst zImage%, zImage.initrd%, \

arch/riscv/boot/dts/canaan/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
ifneq ($(CONFIG_SOC_CANAAN_K210_DTB_SOURCE),"")
3-
dtb-y += $(strip $(shell echo $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))).dtb
2+
dtb-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb, $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))
43
obj-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .o, $(dtb-y))
5-
endif

0 commit comments

Comments
 (0)