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

[Xen-changelog] [xen-unstable] stubdom: correct handling DESTDIR during build



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1279726579 -3600
# Node ID 8f5c50120366884d40a81f82c477bffea82f5c88
# Parent  e8dbc1262f52f0d710dc73e43aafc42ed9d7e31b
stubdom: correct handling DESTDIR during build

The stubdom/Makefile expects components to install themselves to
stubdom/$(CROSS_ROOT) and passes the appropriate configure and make
variables to make this happen.

However if the top-level build uses DESTDIR then this not only effects
the installation targets in stubdom/Makefile but is also propagated to
the individual components' build causing them to install into an
unexpected location and breaking the build.

In other words "make -C stubdom DESTDIR=/tmp/a-dest-dir" fails due to missing
headers because they had been installed into /tmp/a-dest-dir instead of
stubdom/$(CROSS_ROOT).

The existing attempt to clear DESTDIR for the newlib install phase was
insufficient.

Define a CROSS_MAKE variable which should be used to recurse into the
cross compiled components and which clears DESTDIR.

Also move the definition of the genpath target to after the first
"all" target so that the default target is all.

I have confirmed that with this fix only the Xen build system outputs end up in
/tmp/a-dest-dir.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 stubdom/Makefile |   54 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff -r e8dbc1262f52 -r 8f5c50120366 stubdom/Makefile
--- a/stubdom/Makefile  Wed Jul 21 09:02:10 2010 +0100
+++ b/stubdom/Makefile  Wed Jul 21 16:36:19 2010 +0100
@@ -78,9 +78,7 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PR
 
 TARGETS=ioemu c caml grub
 
-STUBDOMPATH="stubdompath.sh"
-genpath-target = $(call buildmakevars2file,$(STUBDOMPATH))
-$(eval $(genpath-target))
+CROSS_MAKE := $(MAKE) DESTDIR=
 
 .PHONY: all
 all: build
@@ -89,6 +87,10 @@ else
 else
 build: genpath
 endif
+
+STUBDOMPATH="stubdompath.sh"
+genpath-target = $(call buildmakevars2file,$(STUBDOMPATH))
+$(eval $(genpath-target))
 
 ##############
 # Cross-newlib
@@ -113,8 +115,8 @@ cross-newlib: $(NEWLIB_STAMPFILE)
        mkdir -p newlib-$(XEN_TARGET_ARCH)
        ( cd newlib-$(XEN_TARGET_ARCH) && \
          CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) 
$(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) 
RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure 
--prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf 
--enable-newlib-io-long-long --disable-multilib && \
-         $(MAKE) && \
-         DESTDIR= $(MAKE) install )
+         $(CROSS_MAKE) && \
+         $(CROSS_MAKE) install )
 
 ############
 # Cross-zlib
@@ -133,8 +135,8 @@ cross-zlib: $(ZLIB_STAMPFILE)
 $(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
        ( cd $< && \
          CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure 
--prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
-         $(MAKE) libz.a && \
-         $(MAKE) install )
+         $(CROSS_MAKE) libz.a && \
+         $(CROSS_MAKE) install )
 
 ##############
 # Cross-libpci
@@ -157,7 +159,7 @@ cross-libpci: $(LIBPCI_STAMPFILE)
          cp ../libpci.config.h lib/config.h && \
          echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
          cp ../libpci.config.mak lib/config.mk && \
-         $(MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(realpath 
$(MINI_OS)/include)" lib/libpci.a && \
+         $(CROSS_MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) 
-I$(realpath $(MINI_OS)/include)" lib/libpci.a && \
          $(INSTALL_DATA) lib/libpci.a 
$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
          $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci 
&& \
          $(INSTALL_DATA) lib/config.h lib/header.h lib/pci.h lib/types.h 
$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
@@ -202,8 +204,8 @@ cross-ocaml: $(OCAML_STAMPFILE)
                -no-pthread -no-shared-libs -no-tk -no-curses \
                -cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector"
        $(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' 
ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
-       $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
-       $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
+       $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
+       $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
        $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
        touch $@
 
@@ -215,7 +217,7 @@ cross-ocaml: $(OCAML_STAMPFILE)
 $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
 
 $(XEN_ROOT)/tools/ioemu-dir:
-       $(MAKE) -C $(XEN_ROOT)/tools ioemu-dir-find
+       $(CROSS_MAKE) -C $(XEN_ROOT)/tools ioemu-dir-find
 
 ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/ioemu-dir
        mkdir -p ioemu
@@ -239,7 +241,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
           ( [ -h include/xen/libelf ] || ln -sf 
../../$(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
          mkdir -p include/xen-foreign && \
          ln -sf $(addprefix ../../,$(wildcard 
$(XEN_ROOT)/tools/include/xen-foreign/*)) include/xen-foreign/ && \
-         $(MAKE) -C include/xen-foreign/ && \
+         $(CROSS_MAKE) -C include/xen-foreign/ && \
          ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign 
include/xen/foreign )
        mkdir -p libxc-$(XEN_TARGET_ARCH)
        [ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd 
libxc-$(XEN_TARGET_ARCH) && \
@@ -251,7 +253,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
          ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
-       $(MAKE) -C $(MINI_OS) links
+       $(CROSS_MAKE) -C $(MINI_OS) links
        touch mk-headers-$(XEN_TARGET_ARCH)
 
 TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
@@ -268,7 +270,7 @@ TARGETS_MINIOS=$(addprefix mini-os-$(XEN
 .PHONY: libxc
 libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a 
libxc-$(XEN_TARGET_ARCH)/libxenguest.a
 libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C 
libxc-$(XEN_TARGET_ARCH)
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) 
-C libxc-$(XEN_TARGET_ARCH)
 
  libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
 
@@ -287,7 +289,7 @@ ioemu: cross-zlib cross-libpci libxc
            TARGET_CFLAGS="$(TARGET_CFLAGS)" \
            TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
            ./xen-setup-stubdom )
-       $(MAKE) -C ioemu
+       $(CROSS_MAKE) -C ioemu
 
 ######
 # caml
@@ -295,7 +297,7 @@ ioemu: cross-zlib cross-libpci libxc
 
 .PHONY: caml
 caml: $(CROSS_ROOT)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) 
-C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
 
 ###
 # C
@@ -303,7 +305,7 @@ caml: $(CROSS_ROOT)
 
 .PHONY: c
 c: $(CROSS_ROOT)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) 
-C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
 
 ######
 # Grub
@@ -322,7 +324,7 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
 .PHONY: grub
 grub: grub-upstream $(CROSS_ROOT)
        mkdir -p grub-$(XEN_TARGET_ARCH)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) 
-C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
 
 ########
 # minios
@@ -331,19 +333,19 @@ grub: grub-upstream $(CROSS_ROOT)
 .PHONY: ioemu-stubdom
 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a 
$(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc 
ioemu
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(APP_OBJS)"
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(APP_OBJS)"
 
 .PHONY: caml-stubdom
 caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc 
caml
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o 
$(CAMLLIB)/libasmrun.a"
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o 
$(CAMLLIB)/libasmrun.a"
 
 .PHONY: c-stubdom
 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS=$(CURDIR)/c/main.a
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS=$(CURDIR)/c/main.a
 
 .PHONY: pv-grub
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_GRUB 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_GRUB 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
 #########
 # install
@@ -380,12 +382,12 @@ clean:
        rm -fr mini-os-$(XEN_TARGET_ARCH)-c
        rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
        rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
-       $(MAKE) -C caml clean
-       $(MAKE) -C c clean
+       $(CROSS_MAKE) -C caml clean
+       $(CROSS_MAKE) -C c clean
        rm -fr grub-$(XEN_TARGET_ARCH)
        rm -f $(STUBDOMPATH)
-       [ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) -C 
libxc-$(XEN_TARGET_ARCH) clean
-       -[ ! -d ioemu ] || $(MAKE) -C ioemu clean
+       [ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(CROSS_MAKE) -C 
libxc-$(XEN_TARGET_ARCH) clean
+       -[ ! -d ioemu ] || $(CROSS_MAKE) -C ioemu clean
 
 # clean the cross-compilation result
 .PHONY: crossclean

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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