All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	"Ian Jackson" <iwj@xenproject.org>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: [XEN PATCH v7 45/51] build: rework cloc recipe
Date: Tue, 24 Aug 2021 11:50:32 +0100	[thread overview]
Message-ID: <20210824105038.1257926-46-anthony.perard@citrix.com> (raw)
In-Reply-To: <20210824105038.1257926-1-anthony.perard@citrix.com>

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(-)

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



  parent reply	other threads:[~2021-08-24 11:01 UTC|newest]

Thread overview: 161+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 10:49 [XEN PATCH v7 00/51] xen: Build system improvements, now with out-of-tree build! Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 01/51] build: introduce cpp_flags macro Anthony PERARD
2021-09-02 10:08   ` Jan Beulich
2021-09-06 10:06     ` Anthony PERARD
2021-09-06 10:30       ` Jan Beulich
2021-09-06 11:21         ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 02/51] build: use if_changed on built_in.o Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 03/51] build: use if_changed_rules with %.o:%.c targets Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 04/51] build: factorise generation of the linker scripts Anthony PERARD
2021-09-07 14:22   ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file Anthony PERARD
2021-09-07  6:14   ` Jan Beulich
2021-09-08 11:14     ` Anthony PERARD
2021-09-08 11:44       ` Ian Jackson
2021-10-11 14:13         ` Andrew Cooper
2021-09-08 12:01       ` Jan Beulich
2021-09-09 10:03         ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 06/51] build,include: rework compat-build-source.py Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 07/51] build,include: rework compat-build-header.py Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 08/51] build: fix clean targets when subdir-y is used Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 09/51] build: use subdir-y in test/Makefile Anthony PERARD
2021-09-02 10:17   ` Jan Beulich
2021-08-24 10:49 ` [XEN PATCH v7 10/51] build,arm: move LDFLAGS change to arch.mk Anthony PERARD
2021-08-24 12:50   ` Julien Grall
2021-08-24 15:00     ` Anthony PERARD
2021-08-24 15:23       ` Julien Grall
2021-08-24 16:14         ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 11/51] build: move make option changes check earlier Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 12/51] build: avoid building arm/arm/*/head.o twice Anthony PERARD
2021-08-24 12:53   ` Julien Grall
2021-08-24 15:12     ` Anthony PERARD
2021-08-24 15:20       ` Julien Grall
2021-08-24 10:50 ` [XEN PATCH v7 13/51] build: convert binfile use to if_changed Anthony PERARD
2021-10-07 13:55   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 14/51] xen: move include/asm-* to arch/*/include/asm Anthony PERARD
2021-10-07 14:17   ` Jan Beulich
2021-10-11 13:57     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 15/51] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 16/51] build: generate "include/xen/compile.h" with if_changed Anthony PERARD
2021-10-07 14:55   ` Jan Beulich
2021-10-11 14:11     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 17/51] build: set XEN_BUILD_EFI earlier Anthony PERARD
2021-10-07 16:14   ` Jan Beulich
2021-10-11 14:21     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 18/51] build: fix $(TARGET).efi creation in arch/arm Anthony PERARD
2021-10-11 10:37   ` Jan Beulich
2021-10-11 14:22     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 19/51] build: fix arch/x86/note.o rule Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk Anthony PERARD
2021-10-11 10:56   ` Jan Beulich
2021-10-11 14:58     ` Anthony PERARD
2021-10-11 15:31       ` Jan Beulich
2021-10-11 17:07         ` Anthony PERARD
2021-10-12  8:06           ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 21/51] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile Anthony PERARD
2021-10-11 11:31   ` Jan Beulich
2021-10-13 12:30     ` Anthony PERARD
2021-10-13 12:41       ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 22/51] build: clean common temporary files from root makefile Anthony PERARD
2021-10-11 11:41   ` Jan Beulich
2021-10-13 10:36     ` Anthony PERARD
2021-10-13 12:32       ` Jan Beulich
2021-10-13 14:26         ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 23/51] build,include: remove arch-*/*.h public header listing from headers*.chk Anthony PERARD
2021-10-11 11:49   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 24/51] build: prepare to always invoke $(MAKE) from xen/, use $(obj) Anthony PERARD
2021-10-11 12:39   ` Jan Beulich
2021-10-13 10:57     ` Anthony PERARD
2021-10-13 12:35       ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 25/51] build: rework test/livepatch/Makefile Anthony PERARD
2021-10-11 13:28   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir Anthony PERARD
2021-10-11 14:02   ` Jan Beulich
2021-10-13 14:24     ` Anthony PERARD
2021-10-14 13:33       ` Anthony PERARD
2021-10-14 13:54         ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 27/51] build: introduce if_changed_deps Anthony PERARD
2021-10-11 14:20   ` Jan Beulich
2021-10-14 13:56     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 28/51] build: rename __LINKER__ to LINKER_SCRIPT Anthony PERARD
2021-10-11 14:23   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 29/51] build: add an other explicite rules to not build $(XEN_ROOT)/.config Anthony PERARD
2021-10-11 14:29   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 30/51] build: hook kconfig into xen build system Anthony PERARD
2021-10-11 15:38   ` Jan Beulich
2021-10-14 15:09     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 31/51] xen/tools/kconfig: fix build with -Wdeclaration-after-statement Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 32/51] build: Remove KBUILD_ specific from Makefile.host Anthony PERARD
2021-10-11 15:47   ` Jan Beulich
2021-10-14 14:18     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 33/51] build: handle always-y and hostprogs-always-y Anthony PERARD
2021-10-11 15:48   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 34/51] build: start building the tools with the main makefiles Anthony PERARD
2021-10-11 15:49   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 35/51] build: Add headers path to CFLAGS once for all archs Anthony PERARD
2021-10-11 15:51   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 36/51] build: generate x86's asm-macros.h with filechk Anthony PERARD
2021-10-11 15:52   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 37/51] build: clean-up "clean" rules of duplication Anthony PERARD
2021-10-11 15:53   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 38/51] build: use main rune to build host binary x86's mkelf32 and mkreloc Anthony PERARD
2021-10-11 15:56   ` Jan Beulich
2021-10-14 14:20     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 39/51] build: rework coverage and ubsan CFLAGS handling Anthony PERARD
2021-10-11 16:04   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 40/51] build: fix dependencies in arch/x86/boot Anthony PERARD
2021-10-14  8:08   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 41/51] build,x86: remove the need for build32.mk Anthony PERARD
2021-10-14  8:32   ` Jan Beulich
2021-10-15 15:52     ` Anthony PERARD
2021-10-18  8:43       ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir Anthony PERARD
2021-10-14  8:51   ` Jan Beulich
2021-10-15 16:29     ` Anthony PERARD
2021-10-18  8:48       ` Jan Beulich
2021-10-21 11:03         ` Anthony PERARD
2021-10-21 11:24           ` Jan Beulich
2021-10-21 13:54             ` Anthony PERARD
2021-10-21 14:16               ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 43/51] build: replace $(BASEDIR) by $(objtree) Anthony PERARD
2021-10-14  9:21   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 44/51] build: add $(srctree) in few key places Anthony PERARD
2021-10-14  9:26   ` Jan Beulich
2021-08-24 10:50 ` Anthony PERARD [this message]
2021-10-14  9:33   ` [XEN PATCH v7 45/51] build: rework cloc recipe Jan Beulich
2021-10-15 16:34     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 46/51] build: replace $(BASEDIR) by $(srctree) Anthony PERARD
2021-10-14  9:36   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 47/51] build: Rework "clean" to clean from the root dir Anthony PERARD
2021-10-14  9:44   ` Jan Beulich
2021-10-15 16:40     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 48/51] build: Rework "headers*.chk" prerequisite in include/ Anthony PERARD
2021-10-14  9:48   ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 49/51] build: adding out-of-tree support to the xen build Anthony PERARD
2021-10-14 10:14   ` Jan Beulich
2021-10-15 16:58     ` Anthony PERARD
2021-10-18  9:02       ` Jan Beulich
2021-10-18  9:51         ` Anthony PERARD
2021-10-18 10:05           ` Jan Beulich
2021-10-18 10:28           ` Juergen Gross
2021-10-18 10:36             ` Jan Beulich
2021-10-18 10:40               ` Juergen Gross
2021-10-18 11:07                 ` Jan Beulich
2021-10-18 11:20                   ` Juergen Gross
2021-10-18 12:03                     ` Jan Beulich
2021-10-21 14:10               ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 50/51] build: specify source tree in include/ for prerequisite Anthony PERARD
2021-10-14 10:19   ` Jan Beulich
2021-10-15 17:02     ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 51/51] build: add %.E targets Anthony PERARD
2021-10-13 15:48   ` Jan Beulich
2021-10-14  6:52     ` Jan Beulich
2021-09-02 10:22 ` [XEN PATCH v7 00/51] xen: Build system improvements, now with out-of-tree build! Jan Beulich
2021-09-06 16:13 ` Anthony PERARD
2021-09-07  6:20   ` Jan Beulich
2021-09-07  7:46   ` Jan Beulich
2021-09-15  9:53 ` Michal Orzel
2021-11-04 15:49 ` Alex Bennée
2021-11-04 16:12   ` Alex Bennée
2021-11-04 16:34   ` Anthony PERARD
2021-11-04 16:59     ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824105038.1257926-46-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.