diff mbox series

[XEN,v6,02/31] build: introduce cpp_flags macro

Message ID 20210701141011.785641-3-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen: Build system improvements | expand

Commit Message

Anthony PERARD July 1, 2021, 2:09 p.m. UTC
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v6:
    - switch to a macro as suggested
      which allows to be used with both a_flags and c_flags
    
    v5:
    - new patch

 xen/Rules.mk                    | 7 +++++--
 xen/arch/x86/mm/Makefile        | 2 +-
 xen/arch/x86/mm/hap/Makefile    | 2 +-
 xen/arch/x86/mm/shadow/Makefile | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

Comments

Jan Beulich July 7, 2021, 2:18 p.m. UTC | #1
On 01.07.2021 16:09, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>     v6:
>     - switch to a macro as suggested
>       which allows to be used with both a_flags and c_flags
>     
>     v5:
>     - new patch
> 
>  xen/Rules.mk                    | 7 +++++--
>  xen/arch/x86/mm/Makefile        | 2 +-
>  xen/arch/x86/mm/hap/Makefile    | 2 +-
>  xen/arch/x86/mm/shadow/Makefile | 2 +-
>  4 files changed, 8 insertions(+), 5 deletions(-)

There are two further uses, one in xen/Makefile and one in
xen/x86/Makefile. I think both want replacing too, and the
former suggests you also want to strip -flto alongside -Wa,%.
I can accept the use in xen/include/Makefile not getting
touched, as it also removes an -include option at the same
time.

Jan
Anthony PERARD July 12, 2021, 10:53 a.m. UTC | #2
On Wed, Jul 07, 2021 at 04:18:18PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> >  xen/Rules.mk                    | 7 +++++--
> >  xen/arch/x86/mm/Makefile        | 2 +-
> >  xen/arch/x86/mm/hap/Makefile    | 2 +-
> >  xen/arch/x86/mm/shadow/Makefile | 2 +-
> >  4 files changed, 8 insertions(+), 5 deletions(-)
> 
> There are two further uses, one in xen/Makefile and one in
> xen/x86/Makefile. I think both want replacing too, and the
> former suggests you also want to strip -flto alongside -Wa,%.
> I can accept the use in xen/include/Makefile not getting
> touched, as it also removes an -include option at the same
> time.

Sounds good, I'll filter -flto and convert "asm-offsets.s" and
"xen.lds".

Thanks,
diff mbox series

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d65d6a48993b..f778058f80a6 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -133,6 +133,9 @@  endif
 # Always build obj-bin files as binary even if they come from C source. 
 $(obj-bin-y): XEN_CFLAGS := $(filter-out -flto,$(XEN_CFLAGS))
 
+# To be use with $(a_flags) or $(c_flags) to produce CPP flags
+cpp_flags = $(filter-out -Wa$(comma)%,$(1))
+
 # Calculation of flags, first the generic flags, then the arch specific flags,
 # and last the flags modified for a target or a directory.
 
@@ -222,13 +225,13 @@  $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
+cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<
 
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
 quiet_cmd_cpp_s_S = CPP     $@
-cmd_cpp_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
+cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 
 %.i: %.c FORCE
 	$(call if_changed,cpp_i_c)
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index b31041644fe8..2818c066f76a 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -15,7 +15,7 @@  guest_walk_%.o: guest_walk.c Makefile
 	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%.i: guest_walk.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%.s: guest_walk.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index 22e7ad54bd33..c6d296b51720 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -9,7 +9,7 @@  guest_walk_%level.o: guest_walk.c Makefile
 	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%level.i: guest_walk.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%level.s: guest_walk.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 770213fe9d84..fd64b4dda925 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -10,7 +10,7 @@  guest_%.o: multi.c Makefile
 	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_%.i: multi.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_%.s: multi.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@