build: out-of-tree building adjustments
v2 cover build: out-of-tree building adjustments
The 1st patch is new, addressing comments on the previously standalone (and unchanged) 2nd patch in a way different from what was discussed.
1: don't export building_out_of_srctree
2: omit "source" symlink when building hypervisor in-tree
Jan
PATCH v2 1/2 build: don't export building_out_of_srctree
I don't view a variable of this name as suitable for exporting, the more that it carries entirely redundant information. The reasons for its introduction in Linux commit 051f278e9d81 ("kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree") also don't apply to us. Ditch exporting of the variable, replacing uses suitably.
---
v2: New.
---
For further reasons (besides the similar redundancy aspect) exporting VPATH looks also suspicious: Its name being all uppercase makes it a "non application private" variable, i.e. it or its (pre-existing) value may have a purpose/use elsewhere. And exporting it looks to be easily
avoidable: Instead of setting it in xen/Makefile, it looks like it could be set in xen/scripts/Kbuild.include. Thoughts?
xen/Makefile +1 -1
@@ -208,7 +208,7 @@ endif objtree := . VPATH := $(srctree) -export building_out_of_srctree srctree objtree VPATH +export srctree objtree VPATH export XEN_ROOT := $(abs_srctree)/..
xen/arch/x86/boot/Makefile +1 -1
@@ -14,7 +14,7 @@ $(obj)/head.o: $(head-bin-objs:.o=.bin) CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -ifdef building_out_of_srctree +ifneq ($(abs_objtree),$(abs_srctree)) CFLAGS_x86_32 += -I$(objtree)/include endif CFLAGS_x86_32 += -I$(srctree)/include
xen/scripts/Makefile.host +1 -1
@@ -88,7 +88,7 @@ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_ $(HOSTCXXFLAGS_$(target-stem).o) # $(objtree)/$(obj) for including generated headers from checkin source files -ifdef building_out_of_srctree +ifneq ($(abs_objtree),$(abs_srctree)) _hostc_flags += -I $(objtree)/$(obj) _hostcxx_flags += -I $(objtree)/$(obj) endif
Re: [PATCH v2 1/2] build: don't export building_out_of_srctree
Quoted 1 line · Jan Beulich
I don't view a variable of this name as suitable for exporting, the more
We could rename it.
Quoted 1 line
that it carries entirely redundant information. The reasons for its
The patch replace building_out_of_srctree with abs_objtree and abs_srctree which also carries redundant informations. abs_objtree can probably be replaced by $(CURDIR), abs_srctree can be recalculated from $(srctree).
Quoted 5 lines
introduction in Linux commit
051f278e9d81("kbuild: replaceKBUILD_SRCTREEwith booleanbuilding_out_of_srctree") also don't apply to us. Ditch exporting of the variable, replacing uses suitably.Signed-off-by Jan Beulich <[email protected]>
This patch feels like obfuscation of the intended test. Instead of reading a test for "out_of_tree", we now have to guess why the two paths are been compared.
Anyway, there isn't that many use outside of the main Makefile, so I guess the patch is kind of ok:
Quoted 4 lines
For further reasons (besides the similar redundancy aspect) exporting VPATH looks also suspicious: Its name being all uppercase makes it a "non application private" variable, i.e. it or its (pre-existing) value may have a purpose/use elsewhere. And exporting it looks to be easily
This sounds like you don't know what VPATH is for, but I'm pretty sure you do. If there's an pre-existing value, we just ignore it. If VPATH is used by a program that our Makefile used and that program is intended to be used by build system then that a bug in that program for not knowing about makes' VPATH. So I don't think we need to worried about it been exported.
Quoted 2 lines
avoidable: Instead of setting it in xen/Makefile, it looks like it could be set in xen/scripts/Kbuild.include. Thoughts?
I'd rather not make that change unless there's a real issue with exporting VPATH. We are more likely to introduce a bug than to avoid one.
Thanks,
Signature · 1 line
Anthony PERARD
Re: [PATCH v2 1/2] build: don't export building_out_of_srctree
Quoted 16 lines · Anthony PERARD
Quoted 1 line · Jan Beulich
I don't view a variable of this name as suitable for exporting, the more
We could rename it.
Quoted 1 line
that it carries entirely redundant information. The reasons for its
The patch replace
building_out_of_srctreewithabs_objtreeandabs_srctreewhich also carries redundant informations.abs_objtreecan probably be replaced by $(CURDIR),abs_srctreecan be recalculated from $(srctree).Quoted 4 lines
introduction in Linux commit
051f278e9d81("kbuild: replaceKBUILD_SRCTREEwith booleanbuilding_out_of_srctree") also don't apply to us. Ditch exporting of the variable, replacing uses suitably.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jan Beulich <[email protected]>This patch feels like obfuscation of the intended test. Instead of reading a test for "
out_of_tree", we now have to guess why the two paths are been compared.
Hmm, it's quite the other way around for me: I view the variable as obfuscating, as it hides what it actually expresses (or better based on what properties it is actually set).
Quoted 3 lines
Anyway, there isn't that many use outside of the main
Makefile, so I guess the patch is kind of ok:Reviewed-by Anthony PERARD <[email protected]>
Thanks.
Quoted 11 lines
Quoted 4 lines
For further reasons (besides the similar redundancy aspect) exporting VPATH looks also suspicious: Its name being all uppercase makes it a "non application private" variable, i.e. it or its (pre-existing) value may have a purpose/use elsewhere. And exporting it looks to be easily
This sounds like you don't know what VPATH is for, but I'm pretty sure you do. If there's an pre-existing value, we just ignore it. If VPATH is used by a program that our
Makefileused and that program is intended to be used by build system then that a bug in that program for not knowing about makes' VPATH. So I don't think we need to worried about it been exported.
We may use programs from our build system which aren't aware they might be used that way. No matter that I know what VPATH is for, I consider its name to violate the shell spec.
Quoted 6 lines
Quoted 2 lines
avoidable: Instead of setting it in xen/Makefile, it looks like it could be set in xen/scripts/Kbuild.include. Thoughts?
I'd rather not make that change unless there's a real issue with exporting VPATH. We are more likely to introduce a bug than to avoid one.
Well, okay, it's surely (hopefully) a highly theoretical consideration anyway.
Jan
PATCH v2 2/2 build: omit "source" symlink when building hypervisor in-tree
In reply to Jan BeulichThis symlink is getting in the way of using e.g. "find" on the xen/ subtree, and it isn't really needed when not building out-of-tree:
The one use that there was can easily be avoided.
.gitignore +0 -1
@@ -295,7 +295,6 @@ xen/include/xen/acm_policy.h xen/include/xen/compile.h xen/include/xen/hypercall-defs.h xen/include/xen/lib/x86/cpuid-autogen.h -xen/source xen/test/livepatch/config.h xen/test/livepatch/expect_config.h xen/test/livepatch/*.livepatch
xen/Makefile +1 -1
@@ -310,7 +310,6 @@ cmd_makefile = { \ } > Makefile outputmakefile: - $(Q)ln -fsn $(srctree) source ifdef building_out_of_srctree $(Q)if [ -f $(srctree)/.config -o \ -d $(srctree)/include/config -o \
@@ -321,6 +320,7 @@ ifdef building_out_of_srctree echo >&2 "***"; \ false; \ fi + $(Q)ln -fsn $(srctree) source $(call cmd,makefile) $(Q)test -e .gitignore || \ { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
xen/common/efi/efi-common.mk +6 -1
@@ -5,11 +5,16 @@ CFLAGS-y += -fshort-wchar CFLAGS-y += -iquote $(srctree)/common/efi CFLAGS-y += -iquote $(srcdir) +source := +ifneq ($(abs_objtree),$(abs_srctree)) +source := source/ +endif + # Part of the command line transforms $(obj) # e.g.: It transforms "dir/foo/bar" into successively # "dir foo bar", ".. .. ..", "../../.." $(obj)/%.c: $(srctree)/common/efi/%.c FORCE - $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/source/common/efi/$(<F) $@ + $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/$(source)common/efi/$(<F) $@ clean-files += $(patsubst %.o, %.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-)) clean-files += common-stub.c
Re: [PATCH v2 2/2] build: omit "source" symlink when building hypervisor in-tree
Quoted 5 lines · Jan Beulich
This symlink is getting in the way of using e.g. "find" on the xen/ subtree, and it isn't really needed when not building out-of-tree:
The one use that there was can easily be avoided.Signed-off-by Jan Beulich <[email protected]>
Thanks,
Signature · 1 line
Anthony PERARD
Ping: [PATCH v2 0/2] build: out-of-tree building adjustments
In reply to Jan BeulichQuoted 5 lines · Jan Beulich
The 1st patch is new, addressing comments on the previously standalone (and unchanged) 2nd patch in a way different from what was discussed.
1: don't export
building_out_of_srctree
2: omit "source" symlink when building hypervisor in-tree
Ping?
Thanks, Jan