Re: [PATCH 7/7] kbuild: remove cc-option-yn, update Docs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)

Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)

This allows us to remove cc-option-yn. Do so and update the docs with
examples.

Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

---
  Documentation/kbuild/makefiles.rst | 22 +++++++++-------------
  scripts/Makefile.compiler          |  5 -----
  2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index db3af0b45baf..4538c36d8df0 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -650,24 +650,20 @@ more details, with real examples.
  	-march=pentium-mmx if supported by $(CC), otherwise -march=i586.
  	The second argument to cc-option is optional, and if omitted,
  	cflags-y will be assigned no value if first option is not supported.
-	Note: cc-option uses KBUILD_CFLAGS for $(CC) options
+	Note: cc-option uses KBUILD_CFLAGS for $(CC) options.
- cc-option-yn
-	cc-option-yn is used to check if gcc supports a given option
-	and return 'y' if supported, otherwise 'n'.
+	cc-option can be combined with conditionals to perform actions based on tool
+	support.
Example:: - #arch/ppc/Makefile
-		biarch := $(call cc-option-yn, -m32)
-		aflags-$(biarch) += -a32
-		cflags-$(biarch) += -m32
+		ifneq ($(call cc-option,$(FLAG)),)
+		# $(FLAG) is supported
- In the above example, $(biarch) is set to y if $(CC) supports the -m32
-	option. When $(biarch) equals 'y', the expanded variables $(aflags-y)
-	and $(cflags-y) will be assigned the values -a32 and -m32,
-	respectively.
-	Note: cc-option-yn uses KBUILD_CFLAGS for $(CC) options
+	Or::
+
+		ifeq ($(call cc-option,$(FLAG)),)
+		# $(FLAG) is not supported
cc-disable-warning
  	cc-disable-warning checks if gcc supports a given warning and returns
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 86ecd2ac874c..c19c0b544c0f 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -51,11 +51,6 @@ __cc-option = $(call try-run,\
  cc-option = $(call __cc-option, $(CC),\
  	$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
-# cc-option-yn
-# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
-cc-option-yn = $(call try-run,\
-	$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
-
  # cc-disable-warning
  # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
  cc-disable-warning = $(call try-run,\




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux