From patchwork Fri Sep 4 01:26:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amerigo Wang X-Patchwork-Id: 45468 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n841RJte001502 for ; Fri, 4 Sep 2009 01:27:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756089AbZIDB0w (ORCPT ); Thu, 3 Sep 2009 21:26:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756093AbZIDB0w (ORCPT ); Thu, 3 Sep 2009 21:26:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23069 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756089AbZIDB0v (ORCPT ); Thu, 3 Sep 2009 21:26:51 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n841Q9BB024760; Thu, 3 Sep 2009 21:26:09 -0400 Received: from localhost.localdomain (dhcp-65-141.nay.redhat.com [10.66.65.141]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n841Q7RF016788; Thu, 3 Sep 2009 21:26:07 -0400 Date: Thu, 3 Sep 2009 21:26:07 -0400 From: Amerigo Wang To: linux-kernel@vger.kernel.org Cc: Peter Oberparleiter , akpm@linux-foundation.org, Sam Ravnborg , Amerigo Wang , linux-kbuild@vger.kernel.org Message-Id: <20090904012835.3749.65615.sendpatchset@localhost.localdomain> In-Reply-To: <20090904012755.3749.69645.sendpatchset@localhost.localdomain> References: <20090904012755.3749.69645.sendpatchset@localhost.localdomain> Subject: [Patch 5/5] Makefile: implement "make foo.c.gcov" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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