xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: julien.grall@arm.com
Cc: andrew.cooper3@citrix.com, sstabellini@kernel.org,
	andrii_anisov@epam.com, jbeulich@suse.com,
	xen-devel@lists.xen.org
Subject: [PATCH v8 10/11] xen: add cloc target
Date: Mon, 30 Jul 2018 10:48:31 -0700	[thread overview]
Message-ID: <1532972912-12439-10-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1807301042060.20701@sstabellini-ThinkPad-X260>

Add a Xen build target to count the lines of code of the source files
built. Uses `cloc' to do the job.

With Xen on ARM taking off in embedded, IoT, and automotive, we are
seeing more and more uses of Xen in constrained environments. Users and
system integrators want the smallest Xen and Dom0 configurations. Some
of these deployments require certifications, where you definitely want
the smallest lines of code count. I provided this patch to give us the
lines of code count for that purpose.

Use the .o.d files to account for all the built source files. Generate a
list for the `cloc' utility and invoke `cloc'.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
CC: jbeulich@suse.com
CC: andrew.cooper3@citrix.com
---
Changes in v4:
- use grep regex to get multiple source files from .d files

Changes in v3:
- remove build as dependecy for the cloc target

Changes in v2:
- change implementation to use .o.d to find built source files
---
 xen/Makefile | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/Makefile b/xen/Makefile
index 62d479c..338d5a3 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -267,3 +267,15 @@ $(KCONFIG_CONFIG):
 include/config/auto.conf.cmd: ;
 
 -include $(BASEDIR)/include/config/auto.conf.cmd
+
+.PHONY: cloc
+cloc:
+	$(eval tmpfile := $(shell mktemp))
+	$(foreach f, $(shell find $(BASEDIR) -name *.o.d), \
+		$(eval path := $(dir $(f))) \
+		$(eval names := $(shell grep -o "[a-zA-Z0-9_/-]*\.[cS]" $(f))) \
+		$(foreach sf, $(names), \
+			$(shell if test -f $(path)/$(sf) ; then echo $(path)/$(sf) >> $(tmpfile); fi;)))
+	cloc --list-file=$(tmpfile)
+	rm $(tmpfile)
+
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-07-30 17:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 17:48 [PATCH v8 00/11] arm: more kconfig configurability and small default configs Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 01/11] arm: remove the ARM HDLCD driver Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 02/11] arm: make it possible to disable HAS_GICV3 Stefano Stabellini
2018-07-31  8:04   ` Jan Beulich
2018-07-31 11:07     ` Julien Grall
2018-07-30 17:48 ` [PATCH v8 03/11] arm: rename HAS_GICV3 to GICV3 Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 04/11] Make MEM_ACCESS configurable Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 05/11] make it possible to enable/disable UART drivers Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 06/11] arm: make it possible to disable the SMMU driver Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 07/11] arm: add a tiny kconfig configuration Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 08/11] arm: add ALL_PLAT, QEMU, Rcar3 and MPSoC configs Stefano Stabellini
2018-07-31 11:17   ` Julien Grall
2018-08-01  7:25   ` Andrii Anisov
2018-08-01 22:43     ` Stefano Stabellini
2018-07-30 17:48 ` [PATCH v8 09/11] xen: add per-platform defaults for NR_CPUS Stefano Stabellini
2018-07-30 17:48 ` Stefano Stabellini [this message]
2018-07-30 17:48 ` [PATCH v8 11/11] xen: specify support for EXPERT and DEBUG Kconfig options Stefano Stabellini
2018-07-31 11:28 ` [PATCH v8 00/11] arm: more kconfig configurability and small default configs Julien Grall
2018-07-31 16:10   ` Stefano Stabellini
2018-08-02 12:07     ` Julien Grall
2018-08-02 20:25       ` Stefano Stabellini

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=1532972912-12439-10-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=andrii_anisov@epam.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=xen-devel@lists.xen.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).