summaryrefslogtreecommitdiffstats
path: root/src/build/mkrules/cc.rules.mk
diff options
context:
space:
mode:
authorZach Clark <zach@ibm.com>2019-05-01 11:18:13 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-05-13 09:10:45 -0500
commit6a2bedba84d0cc0b4a8837341e516a491218b729 (patch)
tree97b465ab89b43692408a5d2329ff7fdb6a65f185 /src/build/mkrules/cc.rules.mk
parent06d0a08aa27fa9e28cc300fbd2814fd9b84d59cf (diff)
downloadtalos-hostboot-6a2bedba84d0cc0b4a8837341e516a491218b729.tar.gz
talos-hostboot-6a2bedba84d0cc0b4a8837341e516a491218b729.zip
Developer Improvement: Get code coverage tool working with Hostboot
This commit fixes GCOV code coverage for P9 with GCC 4.9.2 Change-Id: Ie1e7c35f67414531dbd6e7a771ac1529a9ebd59d RTC: 208351 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76812 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Ilya Smirnov <ismirno@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> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/build/mkrules/cc.rules.mk')
-rw-r--r--src/build/mkrules/cc.rules.mk33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/build/mkrules/cc.rules.mk b/src/build/mkrules/cc.rules.mk
index c89995f82..584b11db4 100644
--- a/src/build/mkrules/cc.rules.mk
+++ b/src/build/mkrules/cc.rules.mk
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2013,2017
+# Contributors Listed Below - COPYRIGHT 2013,2019
# [+] International Business Machines Corp.
#
#
@@ -31,11 +31,27 @@ $(OBJDIR)/%.list : $(OBJDIR)/%.o
$(C2) " OBJDUMP $(notdir $<)"
$(C1)$(OBJDUMP) -rdlCS $< > $@
+# SOURCE_FILE and INCLUDE_DIRS are variables that are either absolute
+# paths to the .C file being compiled and the include directories if
+# we're building with gcov, or else they are relative paths
+# otherwise. The key thing to remember is that they are lazily
+# expanded, so they're relevant to whatever rule they're used in. We
+# don't want to always have absolute paths because of build
+# performance and because it causes the build output with
+# BUILD_VERBOSE to be larger and less readable.
+ifdef HOSTBOOT_PROFILE
+SOURCE_FILE=$(shell readlink -f $<)
+INCLUDE_DIRS=$(shell $(ROOTPATH)/src/build/tools/cflags.sh $(INCFLAGS))
+else
+SOURCE_FILE=$<
+INCLUDE_DIRS=$(INCFLAGS)
+endif
+
$(OBJDIR)/%.o : %.C
@mkdir -p $(OBJDIR)
$(C2) " CXX $(notdir $<)"
- $(C1)$(CXX) -c $(call FLAGS_FILTER, $(CXXFLAGS), $<) $< \
- -o $@.trace $(INCFLAGS) -iquote .
+ $(C1)$(CXX) -c $(call FLAGS_FILTER, $(CXXFLAGS), $<) $(SOURCE_FILE) \
+ -o $@.trace $(INCLUDE_DIRS) -iquote .
$(C1)$(TRACE_HASHER) $@ $(TRACE_FLAGS)
@rm $@.trace
@@ -43,7 +59,8 @@ $(OBJDIR)/%.o : %.C
$(OBJDIR)/%.o : %.cc
@mkdir -p $(OBJDIR)
$(C2) " CXX $(notdir $<)"
- $(C1)$(CXX) -c $(CXXFLAGS) $< -o $@.trace $(INCFLAGS) -iquote .
+ $(C1)$(CXX) -c $(CXXFLAGS) $(SOURCE_FILE) -o $@.trace \
+ $(INCLUDE_DIRS) -iquote .
$(C1)$(TRACE_HASHER) $@ $(TRACE_FLAGS)
@rm $@.trace
@@ -54,12 +71,12 @@ $(OBJDIR)/%.o : %.c
# CC_OVERRIDE is set in the makefile of the component
ifndef CC_OVERRIDE
$(C2) " CC $(notdir $<)"
- $(C1)$(CC) -c $(call FLAGS_FILTER, $(CFLAGS), $<) $< \
- -o $@.trace $(INCFLAGS) -iquote .
+ $(C1)$(CC) -c $(call FLAGS_FILTER, $(CFLAGS), $<) $(SOURCE_FILE) \
+ -o $@.trace $(INCLUDE_DIRS) -iquote .
else
$(C2) " CXX $(notdir $<)"
- $(C1)$(CXX) -c $(call FLAGS_FILTER, $(CXXFLAGS), $<) $< \
- -o $@.trace $(INCFLAGS) -iquote .
+ $(C1)$(CXX) -c $(call FLAGS_FILTER, $(CXXFLAGS), $<) $(SOURCE_FILE) \
+ -o $@.trace $(INCLUDE_DIRS) -iquote .
endif
$(C1)$(TRACE_HASHER) $@ $(TRACE_FLAGS)
@rm $@.trace
OpenPOWER on IntegriCloud