From: BitKeeper B. <ri...@su...> - 2005-01-25 03:17:18
|
ChangeSet 1.1676, 2005/01/22 22:03:34+00:00, ia...@la... Description: use DESTDIR correctly Standard makefiles always attempt to install to the root(/). Setting DESTDIR is the normal way to install to an alternative location. Setting prefix has the possibility of breaking programs, as the prefix may have been embedded inside a compiled binary. From: Adam Heath <do...@br...> Signed-off-by: ian...@cl... Makefile | 11 ++++++----- buildconfigs/mk.linux-2.4-xen0 | 4 ++-- buildconfigs/mk.linux-2.4-xenU | 4 ++-- buildconfigs/mk.linux-2.6-xen0 | 4 ++-- buildconfigs/mk.linux-2.6-xenU | 4 ++-- docs/Makefile | 13 +++++++------ tools/examples/Makefile | 20 ++++++++++---------- tools/libxc/Makefile | 12 ++++++------ tools/libxutil/Makefile | 8 ++++---- tools/misc/Makefile | 8 ++++---- tools/misc/miniterm/Makefile | 4 ++-- tools/python/Makefile | 6 +++++- tools/sv/Makefile | 14 +++++++------- tools/xentrace/Makefile | 12 ++++++------ tools/xfrd/Makefile | 4 ++-- xen/Makefile | 20 ++++++++++---------- 16 files changed, 77 insertions(+), 71 deletions(-) diff -Nru a/Makefile b/Makefile --- a/Makefile 2005-01-24 22:17:15 -05:00 +++ b/Makefile 2005-01-24 22:17:15 -05:00 @@ -2,8 +2,9 @@ # Grand Unified Makefile for Xen. # -DIST_DIR ?= $(shell pwd)/dist -INSTALL_DIR ?= $(DIST_DIR)/install +DIST_DIR := $(CURDIR)/dist +DESTDIR := $(DIST_DIR)/install + INSTALL := install INSTALL_DIR := $(INSTALL) -d -m0755 INSTALL_DATA := $(INSTALL) -m0644 @@ -18,7 +19,7 @@ XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) ) -export INSTALL_DIR +export DESTDIR include buildconfigs/Rules.mk @@ -56,10 +57,10 @@ $(INSTALL_PROG) tools/check/chk tools/check/check_* $(DIST_DIR)/check xen: - $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C xen install + $(MAKE) dist=yes -C xen install tools: - $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C tools install + $(MAKE) dist=yes -C tools install kernels: $(addsuffix -build,$(XKERNELS)) diff -Nru a/buildconfigs/mk.linux-2.4-xen0 b/buildconfigs/mk.linux-2.4-xen0 --- a/buildconfigs/mk.linux-2.4-xen0 2005-01-24 22:17:15 -05:00 +++ b/buildconfigs/mk.linux-2.4-xen0 2005-01-24 22:17:15 -05:00 @@ -15,9 +15,9 @@ build: $(LINUX_DIR)/include/linux/autoconf.h if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \ $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \ - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) modules_install ; \ + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \ fi - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install patches/tmp/ebtables.diff: mkdir -p patches/tmp diff -Nru a/buildconfigs/mk.linux-2.4-xenU b/buildconfigs/mk.linux-2.4-xenU --- a/buildconfigs/mk.linux-2.4-xenU 2005-01-24 22:17:15 -05:00 +++ b/buildconfigs/mk.linux-2.4-xenU 2005-01-24 22:17:15 -05:00 @@ -15,9 +15,9 @@ build: $(LINUX_DIR)/include/linux/autoconf.h if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \ $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \ - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) modules_install ; \ + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \ fi - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install $(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER) rm -rf $(LINUX_DIR) diff -Nru a/buildconfigs/mk.linux-2.6-xen0 b/buildconfigs/mk.linux-2.6-xen0 --- a/buildconfigs/mk.linux-2.6-xen0 2005-01-24 22:17:15 -05:00 +++ b/buildconfigs/mk.linux-2.6-xen0 2005-01-24 22:17:15 -05:00 @@ -15,9 +15,9 @@ build: $(LINUX_DIR)/include/linux/autoconf.h if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \ $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \ - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) modules_install ; \ + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \ fi - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install $(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER) rm -rf $(LINUX_DIR) diff -Nru a/buildconfigs/mk.linux-2.6-xenU b/buildconfigs/mk.linux-2.6-xenU --- a/buildconfigs/mk.linux-2.6-xenU 2005-01-24 22:17:15 -05:00 +++ b/buildconfigs/mk.linux-2.6-xenU 2005-01-24 22:17:15 -05:00 @@ -15,9 +15,9 @@ build: $(LINUX_DIR)/include/linux/autoconf.h if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \ $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \ - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) modules_install ; \ + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \ fi - $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install + $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install $(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER) rm -rf $(LINUX_DIR) diff -Nru a/docs/Makefile b/docs/Makefile --- a/docs/Makefile 2005-01-24 22:17:15 -05:00 +++ b/docs/Makefile 2005-01-24 22:17:15 -05:00 @@ -11,7 +11,8 @@ LATEX2HTML := latex2html package = xen -docdir = /usr/share/doc +prefix = /usr +docdir = $(prefix)/share/doc pkgdocdir = $(docdir)/$(package) DOC_TEX := $(wildcard src/*.tex) @@ -37,11 +38,11 @@ rm -rf $(GFX) ps pdf html install: all - rm -rf $(prefix)$(pkgdocdir) - $(INSTALL_DIR) $(prefix)$(pkgdocdir) - cp -dR ps $(prefix)$(pkgdocdir) - cp -dR pdf $(prefix)$(pkgdocdir) - cp -dR html $(prefix)$(pkgdocdir) + rm -rf $(DESTDIR)$(pkgdocdir) + $(INSTALL_DIR) $(DESTDIR)$(pkgdocdir) + cp -dR ps $(DESTDIR)$(pkgdocdir) + cp -dR pdf $(DESTDIR)$(pkgdocdir) + cp -dR html $(DESTDIR)$(pkgdocdir) pdf/%.pdf: ps/%.ps $(INSTALL_DIR) $(@D) diff -Nru a/tools/examples/Makefile b/tools/examples/Makefile --- a/tools/examples/Makefile 2005-01-24 22:17:15 -05:00 +++ b/tools/examples/Makefile 2005-01-24 22:17:15 -05:00 @@ -25,23 +25,23 @@ install: all install-initd install-configs install-scripts install-initd: - $(INSTALL_DIR) $(prefix)/etc/init.d - $(INSTALL_PROG) $(XEND_INITD) $(prefix)/etc/init.d - $(INSTALL_PROG) $(XENDOMAINS_INITD) $(prefix)/etc/init.d + $(INSTALL_DIR) $(DESTDIR)/etc/init.d + $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d + $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d install-configs: - $(INSTALL_DIR) $(prefix)$(XEN_CONFIG_DIR) - $(INSTALL_DIR) $(prefix)$(XEN_CONFIG_DIR)/auto + $(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR) + $(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)/auto for i in $(XEN_CONFIGS); \ - do [ -a $(prefix)/$(XEN_CONFIG_DIR)/$$i ] || \ - $(INSTALL_DATA) $$i $(prefix)$(XEN_CONFIG_DIR); \ + do [ -a $(DESTDIR)/$(XEN_CONFIG_DIR)/$$i ] || \ + $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \ done install-scripts: - $(INSTALL_DIR) $(prefix)$(XEN_SCRIPT_DIR) + $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) for i in $(XEN_SCRIPTS); \ - do [ -a $(prefix)/$()/$$i ] || \ - $(INSTALL_PROG) $$i $(prefix)$(XEN_SCRIPT_DIR); \ + do [ -a $(DESTDIR)/$()/$$i ] || \ + $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ done clean: diff -Nru a/tools/libxc/Makefile b/tools/libxc/Makefile --- a/tools/libxc/Makefile 2005-01-24 22:17:15 -05:00 +++ b/tools/libxc/Makefile 2005-01-24 22:17:15 -05:00 @@ -68,12 +68,12 @@ ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . ) install: all - $(INSTALL_DIR) $(prefix)/usr/lib - $(INSTALL_DIR) $(prefix)/usr/include - $(INSTALL_PROG) $(LIB) $(prefix)/usr/lib - ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(prefix)/usr/lib/$(LIB_NAME).so.$(MAJOR) - ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so - $(INSTALL_DATA) xc.h $(prefix)/usr/include + $(INSTALL_DIR) $(DESTDIR)/usr/lib + $(INSTALL_DIR) $(DESTDIR)/usr/include + $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/lib + ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR) + ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so + $(INSTALL_DATA) xc.h $(DESTDIR)/usr/include clean: rm -rf *.a *.so *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen diff -Nru a/tools/libxutil/Makefile b/tools/libxutil/Makefile --- a/tools/libxutil/Makefile 2005-01-24 22:17:15 -05:00 +++ b/tools/libxutil/Makefile 2005-01-24 22:17:15 -05:00 @@ -72,10 +72,10 @@ fi install: all - $(INSTALL_DIR) -p $(prefix)/usr/lib - $(INSTALL_PROG) $(LIB) $(prefix)/usr/lib - ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(prefix)/usr/lib/$(LIB_NAME).so.$(MAJOR) - ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so + $(INSTALL_DIR) -p $(DESTDIR)/usr/lib + $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/lib + ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR) + ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so clean: $(RM) *.a *.so *.so.* *.o *.opic *.rpm diff -Nru a/tools/misc/Makefile b/tools/misc/Makefile --- a/tools/misc/Makefile 2005-01-24 22:17:15 -05:00 +++ b/tools/misc/Makefile 2005-01-24 22:17:15 -05:00 @@ -23,10 +23,10 @@ $(MAKE) -C miniterm install: all - $(INSTALL_DIR) $(prefix)/usr/bin - $(INSTALL_DIR) $(prefix)/usr/sbin - $(INSTALL_PROG) $(INSTALL_BIN) $(prefix)/usr/bin - $(INSTALL_PROG) $(INSTALL_SBIN) $(prefix)/usr/sbin + $(INSTALL_DIR) $(DESTDIR)/usr/bin + $(INSTALL_DIR) $(DESTDIR)/usr/sbin + $(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin + $(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin $(MAKE) -C miniterm install clean: diff -Nru a/tools/misc/miniterm/Makefile b/tools/misc/miniterm/Makefile --- a/tools/misc/miniterm/Makefile 2005-01-24 22:17:15 -05:00 +++ b/tools/misc/miniterm/Makefile 2005-01-24 22:17:15 -05:00 @@ -9,8 +9,8 @@ all: $(TARGET) install: all - $(INSTALL_DIR) $(prefix)/usr/bin - $(INSTALL_PROG) $(TARGET) $(prefix)/usr/bin + $(INSTALL_DIR) $(DESTDIR)/usr/bin + $(INSTALL_PROG) $(TARGET) $(DESTDIR)/usr/bin clean: $(RM) *.o $(TARGET) *~ diff -Nru a/tools/python/Makefile b/tools/python/Makefile --- a/tools/python/Makefile 2005-01-24 22:17:15 -05:00 +++ b/tools/python/Makefile 2005-01-24 22:17:15 -05:00 @@ -3,7 +3,11 @@ python setup.py build install: all - python setup.py install --home="$(prefix)/usr" + if [ "$(DESTDIR)" = "" ]; then \ + python setup.py install; \ + else \ + python setup.py install --root="$(DESTDIR)"; \ + fi |