diff mbox series

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

Message ID 20210824105038.1257926-46-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen: Build system improvements, now with out-of-tree build! | expand

Commit Message

Anthony PERARD Aug. 24, 2021, 10:50 a.m. UTC
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@citrix.com>
---
 xen/Makefile | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Jan Beulich Oct. 14, 2021, 9:33 a.m. UTC | #1
On 24.08.2021 12:50, Anthony PERARD wrote:
> After folowing patches, the recipe doesn't work anymore.
>     - build: build everything from the root dir, use obj=$subdir
>     - build: introduce if_changed_deps

That was some 20 patches ago - shouldn't all make goals continue to
work at every step?

> 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.

Not sure whether that's acceptable - Stefano, iirc it was you who
introduced this goal.

Jan
Anthony PERARD Oct. 15, 2021, 4:34 p.m. UTC | #2
On Thu, Oct 14, 2021 at 11:33:16AM +0200, Jan Beulich wrote:
> On 24.08.2021 12:50, Anthony PERARD wrote:
> > After folowing patches, the recipe doesn't work anymore.
> >     - build: build everything from the root dir, use obj=$subdir
> >     - build: introduce if_changed_deps
> 
> That was some 20 patches ago - shouldn't all make goals continue to
> work at every step?

That would be better yes, I'll look at bringing this patch earlier,
which would probably mean making changes to the rule several more time.

> > 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.
> 
> Not sure whether that's acceptable - Stefano, iirc it was you who
> introduced this goal.
> 
> Jan
>
diff mbox series

Patch

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