public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Yuwei Chen <yuwei.chen@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Oliver Steffen <osteffen@redhat.com>,
	Rebecca Cran <rebecca@bsdio.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH v3 2/3] BaseTools: adapt comniler checks mmacros for edk2
Date: Mon,  4 Apr 2022 11:32:28 +0200	[thread overview]
Message-ID: <20220404093229.1971782-3-kraxel@redhat.com> (raw)
In-Reply-To: <20220404093229.1971782-1-kraxel@redhat.com>

edk2 BaseTools use BUILD_CC not CC.  Update the check macros
accordingly so they actually work with BaseTools.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 BaseTools/Source/C/Makefiles/compiler.makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/compiler.makefile b/BaseTools/Source/C/Makefiles/compiler.makefile
index b575391c08d6..3337857ca9c5 100644
--- a/BaseTools/Source/C/Makefiles/compiler.makefile
+++ b/BaseTools/Source/C/Makefiles/compiler.makefile
@@ -18,7 +18,7 @@ cc-cross-prefix = $(firstword $(foreach c, $(1), \
 TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
 
 # try-run
-# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Usage: option = $(call try-run, $(BUILD_CC)...-o "$$TMP",option-ok,otherwise)
 # Exit code chooses option. "$$TMP" serves as a temporary file and is
 # automatically cleaned up.
 try-run = $(shell set -e;		\
@@ -34,34 +34,34 @@ try-run = $(shell set -e;		\
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
 
 as-option = $(call try-run,\
-	$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
+	$(BUILD_CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
 
 # as-instr
 # Usage: cflags-y += $(call as-instr,instr,option1,option2)
 
 as-instr = $(call try-run,\
-	printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
+	printf "%b\n" "$(1)" | $(BUILD_CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
 
 # __cc-option
-# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
+# Usage: MY_CFLAGS += $(call __cc-option,$(BUILD_CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
 __cc-option = $(call try-run,\
 	$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
 
 # cc-option
 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
 
-cc-option = $(call __cc-option, $(CC),\
+cc-option = $(call __cc-option, $(BUILD_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)
+	$(BUILD_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,\
-	$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+	$(BUILD_CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
 
 # cc-ifversion
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
@@ -69,7 +69,7 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e
 
 # ld-option
 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
-ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
+ld-option = $(call try-run, $(BUILD_LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
 
 # ld-ifversion
 # Usage:  $(call ld-ifversion, -ge, 22252, y)
-- 
2.35.1


  parent reply	other threads:[~2022-04-04  9:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04  9:32 [PATCH v3 0/3] BaseTools: fix gcc workaround Gerd Hoffmann
2022-04-04  9:32 ` [PATCH v3 1/3] BaseTools: import compiler check macros from linux kernel Gerd Hoffmann
2022-04-04  9:32 ` Gerd Hoffmann [this message]
2022-04-04  9:32 ` [PATCH v3 3/3] BaseTools: fix gcc workaround Gerd Hoffmann
2022-04-04 15:18 ` [edk2-devel] [PATCH v3 0/3] " Pedro Falcato
2022-04-07 10:12   ` Gerd Hoffmann
2022-04-09  3:53     ` Bob Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220404093229.1971782-3-kraxel@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox