[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090904012835.3749.65615.sendpatchset@localhost.localdomain>
Date: Thu, 3 Sep 2009 21:26:07 -0400
From: Amerigo Wang <amwang@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>,
akpm@...ux-foundation.org, Sam Ravnborg <sam@...nborg.org>,
Amerigo Wang <amwang@...hat.com>, linux-kbuild@...r.kernel.org
Subject: [Patch 5/5] Makefile: implement "make foo.c.gcov"
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@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists