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

[XEN PATCH v7 45/51] build: rework cloc recipe


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 24 Aug 2021 11:50:32 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Ian Jackson" <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 24 Aug 2021 11:01:43 +0000
  • Ironport-hdrordr: A9a23:SaWcj6NZFIw1HsBcT33155DYdb4zR+YMi2TDiHoddfUFSKalfp 6V98jzjSWE7gr4WBkb+exoS5PwOE80lKQFqrX5Uo3SODUO1FHHEGgA1/qp/9SDIVyYygc178 4JH8dD4bbLfDtHZLPBkWyF+qEbsbu6Gc6T5Nv2/jNId0VHeqtg5wB2BkKwCUttXjRLApI/Cd 61+tdHjyDIQwVaUu2LQl0+G8TTrdzCk5zrJTQcAQQ81QWIhTS0rJbnDhmj2AsEWT8n+8ZszY GFqX222kyQiYD69vbu7R6R032Qoqqi9jJ3Pr3MtiHSEESotu/nXvUkZ1TIhkFMnAjm0idQrD CLmWZsAy070QKqQkil5RTqwAXuyzAo9jvrzkKZm2LqpYjjSCs9ENcpv/MuTvL10TtVgDhH6t M944tZjesnMTrQ2CDmo9TYXRBjkUS55XIkjO4IlnRaFY8TcqVYo4AT9F5cVM5oJlOz1Kk3VO 11SM3M7vdfdl2XK3jfo2l02dSpGnA+BA2PTEQOstGclzJWgHd6xU0Fw9F3pAZIyLstD51fo+ jUOKVhk79DCscQcKJmHe8EBdC6D2TcKCi8RV564W6XZp3vHki91aIfzI9FmN1CSaZ4v6fawq 6xLW+wnVRCBH7GGImU2oFX/lTXXGCwNA6duv1j2w==
  • Ironport-sdr: Ubg3qgVyfvbrTwyewNxqT5RGvwVUhQ2qV4dJWl/Nl5iTvb9pIMdQIJtrQXJZp51z3g4ThjDVL1 OR70pnT0QUZs6EqIq/km1xyqD6emaboy9jQaZCaaaO36qX9RlSMYLi39c0aQJ5WHV1cL3hcGxe altK5+1Pv5WfioqPTvVe5nUVr6tLC3azohMGif8p3bLgO5Fxaoq4Z7Q24kjSESatBCi4vBI2bV VrO5jxU6vvJ5pDkr5ccm4BiVEthMH6S6JSltusS62EDW3IwslkdqPNQCoSLjZYz3VdrPanBDVA ahZwzoYtVsmMVnO7fh8U0jD+
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

After folowing patches, the recipe doesn't work anymore.
    - build: build everything from the root dir, use obj=$subdir
    - build: introduce if_changed_deps

First patch mean that $(names) already have $(path), and the second
one, the .*.d files are replaced by .*.cmd files which are much
simpler to parse here.

Also replace the makefile programming by a much simpler shell command.

This doesn't check anymore if the source file exist, but that can be
fixed by running `make clean`, and probably doesn't impact the
calculation. `cloc` just complain that some files don't exist.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 xen/Makefile | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 36a64118007b..b09584e33f9c 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -490,14 +490,7 @@ _MAP:
 
 .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)
+       find . -name '*.o.cmd' -exec awk '/^source_/{print $$3;}' {} + | cloc 
--list-file=-
 
 endif #config-build
 
-- 
Anthony PERARD




 


Rackspace

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