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.per...@citrix.com>
---
 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


Reply via email to