From: Amerigo Wang <amwang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>,
akpm@linux-foundation.org, Sam Ravnborg <sam@ravnborg.org>,
Amerigo Wang <amwang@redhat.com>,
linux-kbuild@vger.kernel.org
Subject: [Patch 5/5] Makefile: implement "make foo.c.gcov"
Date: Thu, 3 Sep 2009 21:26:07 -0400 [thread overview]
Message-ID: <20090904012835.3749.65615.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090904012755.3749.69645.sendpatchset@localhost.localdomain>
Implement "make path/to/file.c.gcov", also introduce a new
env variable "GCOV_OBJ_DIR" which should point to the objects
directory of gcov.
(defaults to /sys/kernel/debug/gcov/path/to/compile)
Signed-off-by: WANG Cong <amwang@redhat.com>
---
Index: linux-2.6/scripts/Makefile.build
===================================================================
--- linux-2.6.orig/scripts/Makefile.build
+++ linux-2.6/scripts/Makefile.build
@@ -169,6 +169,13 @@ cmd_cc_symtypes_c =
$(obj)/%.symtypes : $(src)/%.c FORCE
$(call cmd,cc_symtypes_c)
+ifdef CONFIG_GCOV_KERNEL
+cmd_gcov_gcov_c = $(srctree)/scripts/gen_gcov.sh $(GCOV_OBJ_DIR) $<
+
+$(obj)/%.c.gcov: $(src)/%.c FORCE
+ $(call cmd,gcov_gcov_c)
+endif
+
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
Index: linux-2.6/Makefile
===================================================================
--- linux-2.6.orig/Makefile
+++ linux-2.6/Makefile
@@ -313,6 +313,7 @@ NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
+GCOV = $(CROSS_COMPILE)gcov
AWK = awk
GENKSYMS = scripts/genksyms/genksyms
DEPMOD = /sbin/depmod
@@ -353,7 +354,7 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
-export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
+export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE GCOV
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
@@ -1517,6 +1518,8 @@ endif
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.o: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.c.gcov: %.c prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.lst: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.s: %.S prepare scripts FORCE
next prev parent reply other threads:[~2009-09-04 1:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 1:25 [RFC Patch 0/5] gcov: integrate gcov into kbuild Amerigo Wang
2009-09-04 1:25 ` [Patch 1/5] gitignore: add .gcov files Amerigo Wang
2009-09-04 1:25 ` [Patch 2/5] Makefile: clean " Amerigo Wang
2009-09-04 1:25 ` [Patch 3/5] doc: move the scripts in gcov.txt to tools/gcov/ Amerigo Wang
2009-09-04 1:25 ` [Patch 4/5] scripts: add gen_gcov.sh Amerigo Wang
2009-09-04 1:26 ` Amerigo Wang [this message]
2009-09-07 8:24 ` [RFC Patch 0/5] gcov: integrate gcov into kbuild Peter Oberparleiter
2009-09-07 9:58 ` Amerigo Wang
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-all 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=20090904012835.3749.65615.sendpatchset@localhost.localdomain \
--to=amwang@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oberpar@linux.vnet.ibm.com \
--cc=sam@ravnborg.org \
/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;
as well as URLs for NNTP newsgroup(s).