[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [XEN PATCH v2 10/12] xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS)



On 17.01.2020 11:53, Anthony PERARD wrote:
> We would like to calculate CFLAGS once and before calling Rules.mk,
> so the variable CFLAGS needs to have the same value across the whole
> build. Thus we need a new variable where some flags can change
> depending on the target name.
> 
> Both the dependency and __OBJECT_FILE__ are such flags that change
> depending on the target, so there are move out of $(CFLAGS).

I'm afraid I don't understand: Being a delayed expansion (or
"recursively expanded") variable, what problem is there when CFLAGS
references $@? Is there a plan to change the variable's flavor? If
so, I'd like to ask for this to be mentioned here. "Calculate once",
at least to me, doesn't imply this.

> @@ -141,9 +137,16 @@ endif
>  # Always build obj-bin files as binary even if they come from C source. 
>  $(obj-bin-y): CFLAGS := $(filter-out -flto,$(CFLAGS))
>  
> +c_flags = -MMD -MF $(@D)/.$(@F).d \
> +          $(CFLAGS) \
> +          '-D__OBJECT_FILE__="$@"'
> +
> +a_flags = -MMD -MF $(@D)/.$(@F).d \
> +          $(AFLAGS)

Is there a reason both get extended over multiple lines?

> --- a/xen/include/Makefile
> +++ b/xen/include/Makefile
> @@ -64,7 +64,7 @@ compat/%.h: compat/%.i Makefile 
> $(BASEDIR)/tools/compat-build-header.py
>       mv -f $@.new $@
>  
>  compat/%.i: compat/%.c Makefile
> -     $(CPP) $(filter-out -Wa$(comma)% -M% %.d -include 
> %/include/xen/config.h,$(CFLAGS)) $(cppflags-y) -o $@ $<
> +     $(CPP) $(filter-out -Wa$(comma)% -M% %.d -include 
> %/include/xen/config.h,$(c_flags)) $(cppflags-y) -o $@ $<

I think this wants to continue to reference $(CFLAGS) and instead have
the -M% and %.d patterns dropped. Similarly I guess as-insn in Config.mk
could then have these two patterns dropped.

Jan

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.