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

[Xen-devel] [PATCH for-4.9] build: stubdom and tools should depend on public header target



Build can fail if stubdom build is run before tools build because:

1. tools/include build uses relative path and depends on XEN_OS
2. stubdom needs tools/include to be built, at which time XEN_OS is
   mini-os and corresponding symlinks are created
3. libraries inside tools needs tools/include to be built, at which
   time XEN_OS is the host os name, but symlinks won't be created
   because they are already there
4. libraries get the wrong headers and fail to build

Since both tools and stubdom build need the public headers, we build
tools/include before stubdom and tools. Remove runes in stubdom and
tools to avoid building tools/include more than once.

The new arrangement ensures tools build gets the correct headers
because XEN_OS is set to host os when building tools/include. As for
stubdom, it explicitly links to the mini-os directory without relying
on XEN_OS so it should fine.

Reported-by: Steven Haigh <netwiz@xxxxxxxxx>
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: Steven Haigh <netwiz@xxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Cc: Julien Grall <Julien.Grall@xxxxxxx>
---
 Makefile         | 10 +++++++---
 stubdom/Makefile |  1 -
 tools/Makefile   |  3 +--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 084588e11e..6c837d7522 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,10 @@ mini-os-dir-force-update: mini-os-dir
 export XEN_TARGET_ARCH
 export DESTDIR
 
+.PHONY: tools_public_headers
+tools_public_headers:
+       $(MAKE) -C tools/include
+
 # build and install everything into the standard system directories
 .PHONY: install
 install: $(TARGS_INSTALL)
@@ -50,11 +54,11 @@ build-xen:
        $(MAKE) -C xen build
 
 .PHONY: build-tools
-build-tools:
+build-tools: tools_public_headers
        $(MAKE) -C tools build
 
 .PHONY: build-stubdom
-build-stubdom: mini-os-dir
+build-stubdom: mini-os-dir tools_public_headers
        $(MAKE) -C stubdom build
 ifeq (x86_64,$(XEN_TARGET_ARCH))
        XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
@@ -101,7 +105,7 @@ install-tools:
        $(MAKE) -C tools install
 
 .PHONY: install-stubdom
-install-stubdom: mini-os-dir
+install-stubdom: mini-os-dir tools_public_headers
        $(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
        XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
diff --git a/stubdom/Makefile b/stubdom/Makefile
index aef705dd1e..db01827070 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -355,7 +355,6 @@ LINK_DIRS := libxc-$(XEN_TARGET_ARCH) xenstore $(foreach 
dir,$(LINK_LIBS_DIRS),l
 LINK_STAMPS := $(foreach dir,$(LINK_DIRS),$(dir)/stamp)
 
 mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET) $(LINK_STAMPS)
-       $(MAKE) -C $(XEN_ROOT)/tools/include
        mkdir -p include/xen && \
           ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) include/xen && 
\
           ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 hvm io 
xsm) include/xen && \
diff --git a/tools/Makefile b/tools/Makefile
index 1396d95b50..496428e3a9 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -5,7 +5,6 @@ export PKG_CONFIG_DIR = $(CURDIR)/pkg-config
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
-SUBDIRS-y += include
 SUBDIRS-y += libs
 SUBDIRS-y += libxc
 SUBDIRS-y += flask
@@ -50,7 +49,7 @@ SUBDIRS-$(OCAML_TOOLS) += ocaml
 endif
 
 ifeq ($(CONFIG_RUMP),y)
-SUBDIRS-y := include libxc xenstore
+SUBDIRS-y := libxc xenstore
 endif
 
 # For the sake of linking, set the sys-root
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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