[CRIU] [PATCH v3] Makefiles: add install target
Kir Kolyshkin
kir at openvz.org
Thu May 2 16:54:07 EDT 2013
Note to package maintainers:
1 Yes we do support DESTDIR.
2 From packaging scripts, use something like this:
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr
(v2: add PREFIX, install to /usr/local not /usr by default)
(v3: fix criu man section -- it is 8 not 1)
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
Documentation/Makefile | 8 +++++++-
Makefile | 11 +++++++++++
Makefile.inc | 5 +++++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0114393..132be6b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -6,6 +6,7 @@ XMLTO := xmlto
SRC += criu.txt
MANS := $(patsubst %.txt,%.8,$(SRC))
+MAN8DIR := $(MANDIR)/man8
all: $(MANS)
@@ -19,4 +20,9 @@ clean:
$(Q) rm -f ./*.xml
$(Q) rm -f ./*.1
-.PHONY: clean
+install: $(MANS)
+ $(E) " INSTALL " $(MANS)
+ $(Q) mkdir -p $(DESTDIR)$(MAN8DIR)
+ $(Q) install $(MANS) $(DESTDIR)$(MAN8DIR)
+
+.PHONY: clean install
diff --git a/Makefile b/Makefile
index c459ce5..cbe5a97 100644
--- a/Makefile
+++ b/Makefile
@@ -201,12 +201,23 @@ criu-$(CRTOOLSVERSION).tar.bz2:
v$(CRTOOLSVERSION) | bzip2 > $@
.PHONY: dist tar
+install: $(PROGRAM) install-man
+ $(E) " INSTALL " $(PROGRAM)
+ $(Q) mkdir -p $(DESTDIR)$(SBINDIR)
+ $(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
+
+install-man:
+ $(Q) $(MAKE) -C Documentation install
+
+.PHONY: install install-man
+
help:
@echo ' Targets:'
@echo ' all - Build all [*] targets'
@echo ' * criu - Build criu'
@echo ' zdtm - Build zdtm test-suite'
@echo ' docs - Build documentation'
+ @echo ' install - Install binary and man page'
@echo ' clean - Clean everything'
@echo ' tags - Generate tags file (ctags)'
@echo ' cscope - Generate cscope database'
diff --git a/Makefile.inc b/Makefile.inc
index f11cdcc..23b4d9e 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -9,3 +9,8 @@ else
endif
export E Q
+
+# Installation paths
+PREFIX := /usr/local
+SBINDIR := $(PREFIX)/sbin
+MANDIR := $(PREFIX)/share/man
--
1.8.1.4
More information about the CRIU
mailing list