|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.9 2/2] build: fix tools/include and stubdom build
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
Fix this by using absolute paths in tools/include Makefile. Provide
mechanism to override the prefix in paths. Use that mechanism in
stubdom build to reduce code duplication.
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>
---
stubdom/Makefile | 13 +++----------
tools/include/Makefile | 34 ++++++++++++++++++----------------
2 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/stubdom/Makefile b/stubdom/Makefile
index 54a2bdda0e..0875f0d7c2 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -353,16 +353,9 @@ 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 && \
- ( [ -h include/xen/sys ] || ln -sf
$(XEN_ROOT)/tools/include/xen-sys/MiniOS include/xen/sys ) && \
- ( [ -h include/xen/libelf ] || ln -sf
$(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
- mkdir -p include/xen-foreign && \
- ln -sf $(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*)
include/xen-foreign/ && \
- $(MAKE) DESTDIR= -C include/xen-foreign/ && \
- ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign
include/xen/foreign )
+ rm -rf include
+ mkdir -p include/xen/libelf
+ $(MAKE) -C $(XEN_ROOT)/tools/include
TOOLS_INCLUDE_PREFIX=$(CURDIR)/include/
$(MAKE) DESTDIR= -C $(MINI_OS) links
touch mk-headers-$(XEN_TARGET_ARCH)
diff --git a/tools/include/Makefile b/tools/include/Makefile
index f1af91c129..8b623566b2 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -4,32 +4,34 @@ include $(XEN_ROOT)/tools/Rules.mk
# Relative to $(XEN_ROOT)/xen/xsm/flask
FLASK_H_DEPEND := policy/initial_sids
+TOOLS_INCLUDE_PREFIX ?= $(XEN_ROOT)/tools/include
+
.PHONY: all
-all: xen-foreign xen/.dir xen-xsm/.dir
+all: $(addprefix $(TOOLS_INCLUDE_PREFIX)/, xen-foreign xen/.dir xen-xsm/.dir)
-.PHONY: xen-foreign
-xen-foreign:
+.PHONY: $(TOOLS_INCLUDE_PREFIX)/xen-foreign
+$(TOOLS_INCLUDE_PREFIX)/xen-foreign:
$(MAKE) -C xen-foreign
-xen/.dir:
- @rm -rf xen
- mkdir -p xen/libelf
- ln -sf $(XEN_ROOT)/xen/include/public/COPYING xen
- ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) xen
- ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 arch-arm
hvm io xsm) xen
- ln -sf ../xen-sys/$(XEN_OS) xen/sys
- ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h)
xen/libelf/
- ln -s ../xen-foreign xen/foreign
- ln -sf $(XEN_ROOT)/xen/include/acpi acpi
+$(TOOLS_INCLUDE_PREFIX)/xen/.dir:
+ @rm -rf $(TOOLS_INCLUDE_PREFIX)/xen
+ mkdir -p $(TOOLS_INCLUDE_PREFIX)/xen/libelf
+ ln -sf $(XEN_ROOT)/xen/include/public/COPYING
$(TOOLS_INCLUDE_PREFIX)/xen
+ ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h)
$(TOOLS_INCLUDE_PREFIX)/xen
+ ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 arch-arm
hvm io xsm) $(TOOLS_INCLUDE_PREFIX)/xen
+ ln -sf $(CURDIR)/xen-sys/$(XEN_OS) $(TOOLS_INCLUDE_PREFIX)/xen/sys
+ ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h)
$(TOOLS_INCLUDE_PREFIX)/xen/libelf/
+ ln -sf $(CURDIR)/xen-foreign $(TOOLS_INCLUDE_PREFIX)/xen/foreign
+ ln -sf $(XEN_ROOT)/xen/include/acpi $(TOOLS_INCLUDE_PREFIX)/acpi
touch $@
# Not xen/xsm as that clashes with link to
# $(XEN_ROOT)/xen/include/public/xsm above.
-xen-xsm/.dir: $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
+$(TOOLS_INCLUDE_PREFIX)/xen-xsm/.dir:
$(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
$(patsubst %,$(XEN_ROOT)/xen/xsm/flask/%,$(FLASK_H_DEPEND))
- mkdir -p xen-xsm/flask
+ mkdir -p $(TOOLS_INCLUDE_PREFIX)/xen-xsm/flask
cd $(XEN_ROOT)/xen/xsm/flask/ && \
- $(SHELL) policy/mkflask.sh $(AWK) $(CURDIR)/xen-xsm/flask
$(FLASK_H_DEPEND)
+ $(SHELL) policy/mkflask.sh $(AWK)
$(TOOLS_INCLUDE_PREFIX)/xen-xsm/flask $(FLASK_H_DEPEND)
touch $@
.PHONY: install
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |