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

[Xen-changelog] [xen staging] xen: add cloc target



commit e78a27db4b8a35168116249ac5e1eabf4ef6c28d
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Tue Jul 31 08:23:01 2018 -0700
Commit:     Julien Grall <julien.grall@xxxxxxx>
CommitDate: Thu Aug 2 12:27:30 2018 +0100

    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>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    CC: jbeulich@xxxxxxxx
    CC: andrew.cooper3@xxxxxxxxxx
    ---
    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 e0b17f61be..e131cf4b71 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -278,3 +278,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)
+
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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