Skip to content

Commit

Permalink
Only build attributeOverride if compiler supports -std=gnu++11
Browse files Browse the repository at this point in the history
GCC prior to 4.8 doesn't support -std=gnu++11, which the attributeOverride
tool requires to build.

Resolves:open-power/op-build/pull/947
Change-Id: I53ad31b56dd90c2cd77f5ca1f91b46e519cdfe48
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38131
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Matthew A. Ploetz <maploetz@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
stewartsmith authored and dcrowell77 committed Jun 19, 2017
1 parent 90ec2e6 commit f43c969
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/build/mkrules/cc.rules.mk
Expand Up @@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
# COPYRIGHT International Business Machines Corp. 2013,2014
# Contributors Listed Below - COPYRIGHT 2013,2017
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -74,3 +76,9 @@ $(IMGDIR)/lib$(MODULE).so : $(OBJECTS) $(ROOTPATH)/src/module.ld $(MODULE_INIT)
$(OBJECTS) $(MODULE_INIT) \
-T $(ROOTPATH)/src/module.ld -o $@
endif

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))
7 changes: 6 additions & 1 deletion src/build/mkrules/dist.targets.mk
Expand Up @@ -71,7 +71,6 @@ COPY_FILES = \
obj/genfiles/targAttrInfo.csv:vpo \
obj/genfiles/target_types_merged.xml:openpower \
obj/genfiles/fapiattrs.xml:openpower \
obj/genfiles/attributeOverride:tools,openpower \
src/usr/targeting/attroverride/README.attr_override:tools,openpower \
src/build/hwpf/prcd_compile.tcl:tools \
src/build/buildpnor/buildSbePart.pl:openpower \
Expand All @@ -96,6 +95,12 @@ COPY_FILES = \
src/usr/targeting/common/xmltohb/bios_metadata_petitboot.xslt:openpower \
$(foreach file, $(call ROOTPATH_WILDCARD,releaseNotes.html), $(file):fsp)\

ifeq ($(call try-cflag,$(CCACHE) $(HOST_PREFIX)g++,-std=gnu++11),-std=gnu++11)
COPY_FILES += obj/genfiles/attributeOverride:tools,openpower
else
COPY_FILES += obj/genfiles/attributeOverride:tools
endif

include ${ROOTPATH}/config.mk
COPY_FILES += $(if $(CONFIG_INCLUDE_XML_OPPOWERVM),src/usr/targeting/common/xmltohb/target_types_oppowervm.xml:openpower) \
$(if $(CONFIG_INCLUDE_XML_OPPOWERVM),src/usr/targeting/common/xmltohb/attribute_types_oppowervm.xml:openpower) \
Expand Down
8 changes: 7 additions & 1 deletion src/usr/targeting/attroverride/makefile
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2014,2016
# Contributors Listed Below - COPYRIGHT 2014,2017
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -49,8 +49,14 @@ include $(ROOTPATH)/config.mk
vpath %.C $(GENDIR)
vpath %.H $(GENDIR)

ifeq ($(call try-cflag,$(CCACHE) $(HOST_PREFIX)g++,-std=gnu++11),-std=gnu++11)
$(OUT_FILE): $(C_FILES) $(H_FILES)
$(C2) " CC $(notdir $@)"
$(C1)$(CCACHE) $(HOST_PREFIX)g++ -std=gnu++11 -O3 -g -o $(OUT_FILE)\
$(foreach dir,$(INC_DIRS), -I $(dir)) -iquote.\
$(foreach file,$^,$(if $(findstring .H,$(file)),,$(file)))
else
$(OUT_FILE): $(C_FILES) $(H_FILES)
$(C2) " GEN-NULL $(notdir $@)"
@(echo '#!/bin/sh'; echo 'exit -1';) > $(OUT_FILE)
endif

0 comments on commit f43c969

Please sign in to comment.