[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 10/10] xen: add cloc target



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@xxxxxxxxxx>
CC: jbeulich@xxxxxxxx
CC: andrew.cooper3@xxxxxxxxxx
---
Changes in v2:
- change implementation to use .o.d to find built source files
---
 xen/Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/Makefile b/xen/Makefile
index 62d479c..7a56742 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -267,3 +267,14 @@ $(KCONFIG_CONFIG):
 include/config/auto.conf.cmd: ;
 
 -include $(BASEDIR)/include/config/auto.conf.cmd
+
+.PHONY: cloc
+cloc: build
+       $(eval tmpfile := $(shell mktemp))
+       $(foreach f, $(shell find $(BASEDIR) -name *.o.d), \
+               $(eval path := $(dir $(f))) \
+               $(eval name := $(shell cat $(f) | head -1 | cut -d " " -f 2)) \
+               $(shell if test -f $(path)/$(name) ; then echo $(path)/$(name) 
>> $(tmpfile); fi;))
+       cloc --list-file=$(tmpfile)
+       rm $(tmpfile)
+
-- 
1.9.1


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.