All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"George Dunlap" <George.Dunlap@eu.citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Tim Deegan" <tim@xen.org>, "Jan Beulich" <jbeulich@suse.com>,
	"Anthony PERARD" <anthony.perard@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [XEN PATCH v3 23/23] xen/build: use if_changed to build guest_%.o
Date: Wed, 26 Feb 2020 11:33:55 +0000	[thread overview]
Message-ID: <20200226113355.2532224-24-anthony.perard@citrix.com> (raw)
In-Reply-To: <20200226113355.2532224-1-anthony.perard@citrix.com>

Use if_changed for building all guest_%.o objects, and make use of
command that already exist.

This patch also introduces CFLAGS_$@, it is used so that flags are
applied to all .o .i and .s targets.

This patch make a change to the way guest_%.o files are built, and now
run the same commands that enforce unique symbols. But with patch
"xen,symbols: rework file symbols selection", symbols should still
select the file symbols directive intended to be used for guest_%.o
objects.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Rules.mk                    |  5 ++++-
 xen/arch/x86/mm/Makefile        | 15 +++++++++------
 xen/arch/x86/mm/hap/Makefile    | 15 +++++++++------
 xen/arch/x86/mm/shadow/Makefile | 15 +++++++++------
 4 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 02cd37d04054..1ffb02f42914 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -115,6 +115,9 @@ endif
 # FIXME LTO broken, but we would need a different way to filter -flto out
 # $(obj-bin-y): CFLAGS := $(filter-out -flto,$(CFLAGS))
 
+# target with its suffix stripped
+target-stem = $(basename $@)
+
 # Calculation of flags, first the generic flags, then the arch specific flags,
 # and last the flags modified for a target or a directory.
 
@@ -123,7 +126,7 @@ a_flags = -MMD -MF $(@D)/.$(@F).d $(XEN_AFLAGS)
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
-c_flags += $(CFLAGS-y)
+c_flags += $(CFLAGS-y) $(CFLAGS_$(target-stem).o)
 a_flags += $(CFLAGS-y) $(AFLAGS-y)
 
 quiet_cmd_ld_builtin = LD      $@
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index a2431fde6bb4..4750bfa0ff91 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -11,11 +11,14 @@ obj-y += p2m.o p2m-pt.o
 obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
 obj-y += paging.o
 
-guest_walk_%.o: guest_walk.c Makefile
-	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+$(foreach gw,$(filter guest_walk_%.o,$(obj-y)),\
+    $(eval CFLAGS_$(gw) = -DGUEST_PAGING_LEVELS=$$*))
 
-guest_walk_%.i: guest_walk.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+guest_walk_%.o: guest_walk.c FORCE
+	$(call if_changed_rule,cc_o_c)
 
-guest_walk_%.s: guest_walk.c Makefile
-	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
+guest_walk_%.i: guest_walk.c FORCE
+	$(call if_changed,cpp_i_c)
+
+guest_walk_%.s: guest_walk.c FORCE
+	$(call if_changed,cc_s_c)
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index 22e7ad54bd33..8cd31e9cdc5e 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -5,11 +5,14 @@ obj-y += guest_walk_4level.o
 obj-y += nested_hap.o
 obj-y += nested_ept.o
 
-guest_walk_%level.o: guest_walk.c Makefile
-	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+$(foreach gw,$(filter guest_walk_%level.o,$(obj-y)),\
+    $(eval CFLAGS_$(gw) = -DGUEST_PAGING_LEVELS=$$*))
 
-guest_walk_%level.i: guest_walk.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+guest_walk_%level.o: guest_walk.c FORCE
+	$(call if_changed_rule,cc_o_c)
 
-guest_walk_%level.s: guest_walk.c Makefile
-	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
+guest_walk_%level.i: guest_walk.c FORCE
+	$(call if_changed,cpp_i_c)
+
+guest_walk_%level.s: guest_walk.c FORCE
+	$(call if_changed,cc_s_c)
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 23d3ff10802c..d11e9e2fac08 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -6,11 +6,14 @@ else
 obj-y += none.o
 endif
 
-guest_%.o: multi.c Makefile
-	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+$(foreach gw,$(filter guest_%.o,$(obj-y)),\
+    $(eval CFLAGS_$(gw) = -DGUEST_PAGING_LEVELS=$$*))
 
-guest_%.i: multi.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+guest_%.o: multi.c FORCE
+	$(call if_changed_rule,cc_o_c)
 
-guest_%.s: multi.c Makefile
-	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
+guest_%.i: multi.c FORCE
+	$(call if_changed,cpp_i_c)
+
+guest_%.s: multi.c FORCE
+	$(call if_changed,cc_s_c)
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2020-02-26 11:41 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 11:33 [Xen-devel] [XEN PATCH v3 00/23] xen: Build system improvements Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 01/23] xen/include: remove include of Config.mk Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 02/23] Makefile: Fix install-tests Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 03/23] xen/build: Remove confusing comment on the %.s:%.S rule Anthony PERARD
2020-02-26 11:53   ` Wei Liu
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 04/23] xen/build: remove use of AFLAGS-y Anthony PERARD
2020-02-26 12:58   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 05/23] xen/build: Allow to test clang .include without asm symlink Anthony PERARD
2020-02-27  9:05   ` Roger Pau Monné
2020-02-27  9:22     ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 06/23] xen/build: Fix section-renaming of libfdt and libelf Anthony PERARD
2020-02-27  9:38   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 07/23] xen/build: Use obj-y += subdir/ instead of subdir-y Anthony PERARD
2020-02-27  9:22   ` Roger Pau Monné
2020-02-27  9:43   ` Jan Beulich
2020-03-04 14:14     ` Jan Beulich
2020-03-05  9:24   ` Jan Beulich
2020-03-05 13:42     ` Andrew Cooper
2020-03-05 15:02     ` Julien Grall
2020-03-05 15:59       ` Anthony PERARD
2020-03-05 16:31         ` Julien Grall
2020-03-09  6:46     ` Tian, Kevin
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 08/23] xen/build: use $(clean) shorthand for clean targets Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 09/23] xen/build: extract clean target from Rules.mk Anthony PERARD
2020-03-04 14:13   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 10/23] xen/build: run targets csopes, tags, .. without Rules.mk Anthony PERARD
2020-03-04 14:17   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 11/23] xen/build: make tests in test/ directly Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 12/23] xen/build: Move as-option-add to xen/ Anthony PERARD
2020-03-04 14:17   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 13/23] xen/build: include include/config/auto.conf in main Makefile Anthony PERARD
2020-03-04 14:29   ` Jan Beulich
2020-03-10 17:10     ` Anthony PERARD
2020-03-11  9:26       ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 14/23] xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS) Anthony PERARD
2020-02-27 10:22   ` Roger Pau Monné
2020-03-10 17:55     ` Anthony PERARD
2020-03-04 14:42   ` Jan Beulich
2020-03-10 17:43     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 15/23] xen/build: have the root Makefile generates the CFLAGS Anthony PERARD
2020-02-27 11:05   ` Roger Pau Monné
2020-03-17 18:05     ` Anthony PERARD
2020-03-19 16:24       ` Anthony PERARD
2020-03-23 15:11         ` Roger Pau Monné
2020-03-24 17:11           ` [Xen-devel] " Anthony PERARD
2020-03-04 15:00   ` Jan Beulich
2020-03-17 18:35     ` Anthony PERARD
2020-03-18 10:20       ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 16/23] xen/build: introduce if_changed and if_changed_rule Anthony PERARD
2020-03-04 15:45   ` Jan Beulich
2020-03-18 10:44     ` Anthony PERARD
2020-03-18 11:14       ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 17/23] xen/build: Start using if_changed Anthony PERARD
2020-02-27 13:09   ` Roger Pau Monné
2020-03-04 16:00     ` Jan Beulich
2020-03-18 10:52       ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 18/23] xen/build: use if_changed on built_in.o Anthony PERARD
2020-03-04 16:03   ` Jan Beulich
2020-03-18 10:55     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 19/23] xen/build: Use if_changed_rules with %.o:%.c targets Anthony PERARD
2020-03-04 16:09   ` Jan Beulich
2020-03-18 11:14     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 20/23] xen/build: factorise generation of the linker scripts Anthony PERARD
2020-02-27 13:14   ` Roger Pau Monné
2020-03-05 11:07     ` Jan Beulich
2020-03-05 11:05   ` Jan Beulich
2020-03-18 11:59     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 21/23] xen/build: Use if_changed for prelink*.o Anthony PERARD
2020-02-27 13:16   ` Roger Pau Monné
2020-03-04 16:12     ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 22/23] xen, symbols: rework file symbols selection Anthony PERARD
2020-03-05 14:44   ` Jan Beulich
2020-02-26 11:33 ` Anthony PERARD [this message]
2020-03-05 15:12   ` [Xen-devel] [XEN PATCH v3 23/23] xen/build: use if_changed to build guest_%.o Jan Beulich
2020-02-27 21:17 ` [Xen-devel] [XEN PATCH v3 00/23] xen: Build system improvements Stewart Hildebrand
2020-03-06 10:12   ` Anthony PERARD

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=20200226113355.2532224-24-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.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.