blob: a9cef3f6c22f4c50f1263692808afd16a40f9640 [file] [log] [blame]
From 9852975319c864b47759cc8d7814bf6f9f0f1f4c Mon Sep 17 00:00:00 2001
From: Stewart Smith <stewart@linux.vnet.ibm.com>
Date: Thu, 3 Nov 2016 14:36:19 +1100
Subject: [PATCH 10/10] Use -std=gnu++03 for host g++ invocations
Seeing as the ancient GCC on RHEL6 doesn't actually support -std=gnu++03
we have to go through some hoops to detect it (we use the same magic
Make as we use in skiboot to do the same)
Change-Id: I338560ae2ebdac842c8055c07519d542564c3923
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
src/usr/hwpf/makefile | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile
index 8d0bb72..ee8cf13 100644
--- a/src/usr/hwpf/makefile
+++ b/src/usr/hwpf/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2015
+# Contributors Listed Below - COPYRIGHT 2011,2016
# [+] International Business Machines Corp.
#
#
@@ -402,18 +402,26 @@ $(call GENTARGET, ${IF_CMP_FLEX_TARGET}) : \
$(C2) " FLEX $(notdir $<)"
$(C1)flex -o$@ $^
+try = $(shell set -e; if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; fi )
+
+try-cflag = $(call try,$(1) $(2) -x c -c /dev/null -o /dev/null,$(2))
+HOSTCFLAGS:=-O3
+HOSTCFLAGS+=$(call try-cflag,$(HOST_PREFIX)g++,-std=gnu++03)
+
$(GENDIR)/$(IF_CMP_SUBDIR)/%.host.o: \
ifcompiler/%.C $(IF_COMPILER_H_FILES) \
$(GENDIR)/$(IF_CMP_YACC_H_TARGET)
$(C2) " CXX $(notdir $<)"
- $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 $< -I ifcompiler -I $(GENDIR) \
+ $(C1)$(CCACHE) $(HOST_PREFIX)g++ $(HOSTCFLAGS) $< -I ifcompiler -I $(GENDIR) \
-I $(GENDIR)/$(IF_CMP_SUBDIR) \
-I $(ROOTPATH)/src/include/usr/hwpf/hwp -c -o $@
$(GENDIR)/$(IF_CMP_YACC_C_TARGET:.c=.host.o): \
$(GENDIR)/$(IF_CMP_YACC_C_TARGET) $(IF_COMPILER_H_FILES)
$(C2) " CXX $(notdir $<)"
- $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 $< -I ifcompiler -I $(GENDIR) \
+ $(C1)$(CCACHE) $(HOST_PREFIX)g++ $(HOSTCFLAGS) $< -I ifcompiler -I $(GENDIR) \
-I $(GENDIR)/$(IF_CMP_SUBDIR) \
-I $(ROOTPATH)/src/include/usr/hwpf/hwp -c -o $@
@@ -421,7 +429,7 @@ $(GENDIR)/$(IF_CMP_FLEX_TARGET:.c=.host.o): \
$(GENDIR)/$(IF_CMP_FLEX_TARGET) $(IF_COMPILER_H_FILES) \
$(GENDIR)/$(IF_CMP_YACC_H_TARGET)
$(C2) " CXX $(notdir $<)"
- $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 -DHOSTBOOT_COMPILE $< -I ifcompiler -I $(GENDIR) \
+ $(C1)$(CCACHE) $(HOST_PREFIX)g++ $(HOSTCFLAGS) -DHOSTBOOT_COMPILE $< -I ifcompiler -I $(GENDIR) \
-I $(GENDIR)/$(IF_CMP_SUBDIR) \
-I $(ROOTPATH)/src/include/usr/hwpf/hwp -c -o $@
--
2.7.4