On Mon, Oct 18, 2021 at 11:02:20AM +0200, Jan Beulich wrote:
> On 15.10.2021 18:58, Anthony PERARD wrote:
> > On Thu, Oct 14, 2021 at 12:14:29PM +0200, Jan Beulich wrote:
> >> On 24.08.2021 12:50, Anthony PERARD wrote:
> >>> --- a/xen/Rules.mk
> >>> +++ b/xen/Rules.mk
> >>> @@ -38,7 +38,7 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, 
> >>> \
> >>>                           $(foreach r,rel rel.ro,data.$(r).local)
> >>>  
> >>>  # The filename build.mk has precedence over Makefile
> >>> -mk-dir := $(src)
> >>> +mk-dir := $(srctree)/$(src)
> >>>  include $(if $(wildcard 
> >>> $(mk-dir)/build.mk),$(mk-dir)/build.mk,$(mk-dir)/Makefile)
> >>
> >> Perhaps already when it was changed to $(src) the name has become
> >> slightly misleading, at least imo: I would rather expect a variable
> >> with this name to refer to the build dir/tree. Maybe "srcdir" or
> >> even shorted "sd" right from the start? (Reaching here I can finally
> >> see why having a shorthand is helpful.)
> > 
> > I have to think about that. I've made some further progress in order to
> > be able to build the Xen pvhshim without a link farm and notice that
> > nearly every source file needs to use "$(srctree)/$(src)"
> 
> Oh, now I'm curious as to the why here. I thought use of $(srctree)
> ought to be the exception.

In Linux, the use of $(srctree) is indeed the exception. This is because
we have VPATH=$(srctree), so when `make` look for a prerequisite or a
target it will look first in the current directory and then in
$(srctree). That works fine as long as the source tree only have sources
and no built files.

But if we want to be able to build the pv-shim without the linkfarm and
thus using out-of-tree build, we are going to need the ability to build
from a non-clean source tree. I don't think another way is possible.

This can be done by teaching make to only look for source file in
$(srctree), and to look for generated/built file only in $(objtree).
That's mostly done by not using VPATH and making few other adjustments.

I hope my description of where I'm going isn't too convoluted.

> > and I'm not
> > sure "$(src)" could be use alone. So having a single variable which have
> > both would be useful.
> > 
> > "srcdir" might be to close to "srctree" and one might mistake it for the
> > other, so "sd" might be better.
> 
> While I did suggest "sd" as an option, already when writing this I
> wasn't convinced this would be descriptive enough. Personally I think
> "dir" and "tree" are sufficiently different names. I would suggest
> "srcroot" for what is now "srctree", but that would have the
> disadvantage of getting us out of sync with Linux.

Ok, I guess "srcdir" is good. Thanks.

-- 
Anthony PERARD

Reply via email to