Stewart Smith | 8b90e5b | 2016-11-03 13:43:24 +1100 | [diff] [blame] | 1 | From 9852975319c864b47759cc8d7814bf6f9f0f1f4c Mon Sep 17 00:00:00 2001 |
| 2 | From: Stewart Smith <stewart@linux.vnet.ibm.com> |
| 3 | Date: Thu, 3 Nov 2016 14:36:19 +1100 |
| 4 | Subject: [PATCH 10/10] Use -std=gnu++03 for host g++ invocations |
| 5 | |
| 6 | Seeing as the ancient GCC on RHEL6 doesn't actually support -std=gnu++03 |
| 7 | we have to go through some hoops to detect it (we use the same magic |
| 8 | Make as we use in skiboot to do the same) |
| 9 | |
| 10 | Change-Id: I338560ae2ebdac842c8055c07519d542564c3923 |
| 11 | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> |
| 12 | --- |
| 13 | src/usr/hwpf/makefile | 16 ++++++++++++---- |
| 14 | 1 file changed, 12 insertions(+), 4 deletions(-) |
| 15 | |
| 16 | diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile |
| 17 | index 8d0bb72..ee8cf13 100644 |
| 18 | --- a/src/usr/hwpf/makefile |
| 19 | +++ b/src/usr/hwpf/makefile |
| 20 | @@ -5,7 +5,7 @@ |
| 21 | # |
| 22 | # OpenPOWER HostBoot Project |
| 23 | # |
| 24 | -# Contributors Listed Below - COPYRIGHT 2011,2015 |
| 25 | +# Contributors Listed Below - COPYRIGHT 2011,2016 |
| 26 | # [+] International Business Machines Corp. |
| 27 | # |
| 28 | # |
| 29 | @@ -402,18 +402,26 @@ $(call GENTARGET, ${IF_CMP_FLEX_TARGET}) : \ |
| 30 | $(C2) " FLEX $(notdir $<)" |
| 31 | $(C1)flex -o$@ $^ |
| 32 | |
| 33 | +try = $(shell set -e; if ($(1)) >/dev/null 2>&1; \ |
| 34 | + then echo "$(2)"; \ |
| 35 | + else echo "$(3)"; fi ) |
| 36 | + |
| 37 | +try-cflag = $(call try,$(1) $(2) -x c -c /dev/null -o /dev/null,$(2)) |
| 38 | +HOSTCFLAGS:=-O3 |
| 39 | +HOSTCFLAGS+=$(call try-cflag,$(HOST_PREFIX)g++,-std=gnu++03) |
| 40 | + |
| 41 | $(GENDIR)/$(IF_CMP_SUBDIR)/%.host.o: \ |
| 42 | ifcompiler/%.C $(IF_COMPILER_H_FILES) \ |
| 43 | $(GENDIR)/$(IF_CMP_YACC_H_TARGET) |
| 44 | $(C2) " CXX $(notdir $<)" |
| 45 | - $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 $< -I ifcompiler -I $(GENDIR) \ |
| 46 | + $(C1)$(CCACHE) $(HOST_PREFIX)g++ $(HOSTCFLAGS) $< -I ifcompiler -I $(GENDIR) \ |
| 47 | -I $(GENDIR)/$(IF_CMP_SUBDIR) \ |
| 48 | -I $(ROOTPATH)/src/include/usr/hwpf/hwp -c -o $@ |
| 49 | |
| 50 | $(GENDIR)/$(IF_CMP_YACC_C_TARGET:.c=.host.o): \ |
| 51 | $(GENDIR)/$(IF_CMP_YACC_C_TARGET) $(IF_COMPILER_H_FILES) |
| 52 | $(C2) " CXX $(notdir $<)" |
| 53 | - $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 $< -I ifcompiler -I $(GENDIR) \ |
| 54 | + $(C1)$(CCACHE) $(HOST_PREFIX)g++ $(HOSTCFLAGS) $< -I ifcompiler -I $(GENDIR) \ |
| 55 | -I $(GENDIR)/$(IF_CMP_SUBDIR) \ |
| 56 | -I $(ROOTPATH)/src/include/usr/hwpf/hwp -c -o $@ |
| 57 | |
| 58 | @@ -421,7 +429,7 @@ $(GENDIR)/$(IF_CMP_FLEX_TARGET:.c=.host.o): \ |
| 59 | $(GENDIR)/$(IF_CMP_FLEX_TARGET) $(IF_COMPILER_H_FILES) \ |
| 60 | $(GENDIR)/$(IF_CMP_YACC_H_TARGET) |
| 61 | $(C2) " CXX $(notdir $<)" |
| 62 | - $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 -DHOSTBOOT_COMPILE $< -I ifcompiler -I $(GENDIR) \ |
| 63 | + $(C1)$(CCACHE) $(HOST_PREFIX)g++ $(HOSTCFLAGS) -DHOSTBOOT_COMPILE $< -I ifcompiler -I $(GENDIR) \ |
| 64 | -I $(GENDIR)/$(IF_CMP_SUBDIR) \ |
| 65 | -I $(ROOTPATH)/src/include/usr/hwpf/hwp -c -o $@ |
| 66 | |
| 67 | -- |
| 68 | 2.7.4 |
| 69 | |