Message ID | 20211125134006.1076646-35-anthony.perard@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen: Build system improvements, now with out-of-tree build! | expand |
On 25/11/2021 13:39, Anthony PERARD wrote: > I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)". > > Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> > --- > xen/Makefile | 4 ++-- > xen/Rules.mk | 5 +++++ > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/xen/Makefile b/xen/Makefile > index 995815e82235..e39a6f82859a 100644 > --- a/xen/Makefile > +++ b/xen/Makefile > @@ -609,10 +609,10 @@ cscope: > _MAP: > $(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map > > -%.o %.i %.s: %.c tools_fixdep FORCE > +%.o %.i %.s %.E: %.c tools_fixdep FORCE > $(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F) So what I hadn't realised when asking was that Linux calls this .i and we've already got support for what I wanted. Sorry :) Thus, I suspect we probably don't want to take an extra %.E alias to the existing %.i, although... > > -%.o %.s: %.S tools_fixdep FORCE > +%.o %.s %.E: %.S tools_fixdep FORCE > $(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F) > > %/: tools_fixdep FORCE > diff --git a/xen/Rules.mk b/xen/Rules.mk > index 73d5b82ab2e7..745d892d0707 100644 > --- a/xen/Rules.mk > +++ b/xen/Rules.mk > @@ -287,6 +287,11 @@ $(obj)/%.s: $(src)/%.c FORCE > $(obj)/%.s: $(src)/%.S FORCE > $(call if_changed_dep,cpp_s_S) > > +$(obj)/%.E: $(src)/%.c FORCE > + $(call if_changed_dep,cpp_i_c) > +$(obj)/%.E: $(src)/%.S FORCE > + $(call if_changed_dep,cpp_s_S) ... I don't currently see support for %.i from %.S in the tree. That one probably would be useful to introduce. ~Andrew > + > # Linker scripts, .lds.S -> .lds > quiet_cmd_cpp_lds_S = LDS $@ > cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
On Thu, Dec 16, 2021 at 11:18:08AM +0000, Andrew Cooper wrote: > On 25/11/2021 13:39, Anthony PERARD wrote: > > I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)". > > > > -%.o %.i %.s: %.c tools_fixdep FORCE > > +%.o %.i %.s %.E: %.c tools_fixdep FORCE > > $(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F) > > So what I hadn't realised when asking was that Linux calls this .i and > we've already got support for what I wanted. Sorry :) > > Thus, I suspect we probably don't want to take an extra %.E alias to the > existing %.i, although... > > > > > -%.o %.s: %.S tools_fixdep FORCE > > +%.o %.s %.E: %.S tools_fixdep FORCE > > +$(obj)/%.E: $(src)/%.c FORCE > > + $(call if_changed_dep,cpp_i_c) > > +$(obj)/%.E: $(src)/%.S FORCE > > + $(call if_changed_dep,cpp_s_S) > > ... I don't currently see support for %.i from %.S in the tree. That > one probably would be useful to introduce. It's %.s for %.S, easy ;-) Yep, %.s may run `gcc -S` or `gcc -E`. And %.i may run `gcc -E` or may not run at all. It seems that Linux have the same rules. So, I guess to run gcc -E, one have to run `make dir/target.i || make dir/target.s` currently, :-). Another thing, %.s:%.S was broken for a while, and no one complained. Cheers,
On 25.11.2021 14:39, Anthony PERARD wrote: > I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)". > > Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> I understand that this patch isn't going to be needed anymore. Jan
diff --git a/xen/Makefile b/xen/Makefile index 995815e82235..e39a6f82859a 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -609,10 +609,10 @@ cscope: _MAP: $(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map -%.o %.i %.s: %.c tools_fixdep FORCE +%.o %.i %.s %.E: %.c tools_fixdep FORCE $(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F) -%.o %.s: %.S tools_fixdep FORCE +%.o %.s %.E: %.S tools_fixdep FORCE $(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F) %/: tools_fixdep FORCE diff --git a/xen/Rules.mk b/xen/Rules.mk index 73d5b82ab2e7..745d892d0707 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -287,6 +287,11 @@ $(obj)/%.s: $(src)/%.c FORCE $(obj)/%.s: $(src)/%.S FORCE $(call if_changed_dep,cpp_s_S) +$(obj)/%.E: $(src)/%.c FORCE + $(call if_changed_dep,cpp_i_c) +$(obj)/%.E: $(src)/%.S FORCE + $(call if_changed_dep,cpp_s_S) + # Linker scripts, .lds.S -> .lds quiet_cmd_cpp_lds_S = LDS $@ cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)". Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- xen/Makefile | 4 ++-- xen/Rules.mk | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)