|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH XTF] Correct the usage of $(DESTDIR) and $(prefix)
The GNU coding standards expect $(DESTDIR) to be the root of everything
installed, and for prefix to then be added to the path. This is not how XTF
previously behaved.
Replace $(PREFIX) with its more common form $(prefix), and rearange $(DESTDIR)
and $(prefix) to match expectation.
Reported-by:Wei Liu <wei.liu2@xxxxxxxxxx>
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Makefile | 15 ++++++++++-----
build/gen.mk | 22 +++++++++++++++-------
2 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index e21605d..c86dbb8 100644
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,14 @@ MAKEFLAGS += -r
ROOT := $(abspath $(CURDIR))
export ROOT
-DESTDIR ?= $(ROOT)/dist
-PREFIX ?= $(ROOT)
-export DESTDIR PREFIX
+# $(prefix) defaults to $(ROOT) so development and testing can be done
+# straight out of the working tree
+prefix ?= $(ROOT)
+DESTDIR ?=
+
+# Provide $(DEST) as the install root
+DEST := $(DESTDIR)$(prefix)
+export DEST DESTDIR prefix
# Programs used
CC ?= $(CROSS_COMPILE)gcc
@@ -27,8 +32,8 @@ all:
.PHONY: install
install:
- @mkdir -p $(DESTDIR)
- $(INSTALL_PROGRAM) -p xtf-runner $(DESTDIR)
+ @mkdir -p $(DEST)
+ $(INSTALL_PROGRAM) -p xtf-runner $(DEST)
@set -e; for D in $(wildcard tests/*); do \
[ ! -e $$D/Makefile ] && continue; \
$(MAKE) -C $$D install; \
diff --git a/build/gen.mk b/build/gen.mk
index 790212b..e20fd77 100644
--- a/build/gen.mk
+++ b/build/gen.mk
@@ -21,6 +21,14 @@ ifneq ($(filter-out $(ALL_CATEGORIES),$(CATEGORY)),)
$(error Unrecognised category '$(filter-out $(ALL_CATEGORIES),$(CATEGORY))')
endif
+ifeq ($(filter /%,$(prefix)),)
+$(error $$(prefix) must be absolute, not '$(prefix)')
+endif
+
+ifeq ($(filter /%,$(DEST)),)
+$(error $$(DEST) must be absolute, not '$(DEST)')
+endif
+
.PHONY: build
build: $(foreach env,$(TEST-ENVS),test-$(env)-$(NAME) test-$(env)-$(NAME).cfg)
build: test-info.json
@@ -31,8 +39,8 @@ test-info.json: $(ROOT)/build/mkinfo.py FORCE
.PHONY: install install-each-env
install: install-each-env test-info.json
- @mkdir -p $(DESTDIR)/tests/$(NAME)
- $(INSTALL_DATA) -p test-info.json $(DESTDIR)/tests/$(NAME)
+ @mkdir -p $(DEST)/tests/$(NAME)
+ $(INSTALL_DATA) -p test-info.json $(DEST)/tests/$(NAME)
define PERENV_build
@@ -54,7 +62,7 @@ test-$(1)-$(NAME).cfg: $$(cfg-$(1)) FORCE
@{ cat $$< $(TEST-EXTRA-CFG) ;} | \
sed -e "s/@@NAME@@/$$(NAME)/g" \
-e "s/@@ENV@@/$(1)/g" \
- -e "s!@@PREFIX@@!$$(PREFIX)!g" \
+ -e "s!@@PREFIX@@!$$(prefix)!g" \
> $$@.tmp
@if ! cmp -s $$@ $$@.tmp; then mv -f $$@.tmp $$@; else rm -f $$@.tmp; fi
@@ -63,12 +71,12 @@ test-$(1)-$(NAME).cfg: $$(cfg-$(1)) FORCE
.PHONY: install-$(1) install-$(1).cfg
install-$(1): test-$(1)-$(NAME)
- @mkdir -p $(DESTDIR)/tests/$(NAME)
- $(INSTALL_PROGRAM) -p $$< $(DESTDIR)/tests/$(NAME)
+ @mkdir -p $(DEST)/tests/$(NAME)
+ $(INSTALL_PROGRAM) -p $$< $(DEST)/tests/$(NAME)
install-$(1).cfg: test-$(1)-$(NAME).cfg
- @mkdir -p $(DESTDIR)/tests/$(NAME)
- $(INSTALL_DATA) -p $$< $(DESTDIR)/tests/$(NAME)
+ @mkdir -p $(DEST)/tests/$(NAME)
+ $(INSTALL_DATA) -p $$< $(DEST)/tests/$(NAME)
install-each-env: install-$(1) install-$(1).cfg
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |