All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gwendal Grignou <gwendal@chromium.org>
To: osandov@osandov.com
Cc: osandov@fb.com, linux-block@vger.kernel.org
Subject: [PATCH v2] makefile: Add install rule
Date: Wed, 14 Nov 2018 11:39:31 -0800	[thread overview]
Message-ID: <20181114193931.90009-1-gwendal@chromium.org> (raw)
In-Reply-To: <CAPUE2uuGz5qOZ0aFVsuATPqt3XCtmj_nSd0rE44wpihRPzkskA@mail.gmail.com>

Add rule to install to a target directory, /usr/local/blktests by
default.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 Makefile     | 11 ++++++++++-
 README.md    |  3 +++
 src/Makefile |  6 +++++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 38b8ad1..9793a2d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,18 @@
+prefix ?= /usr/local
+dest = $(DESTDIR)$(prefix)/blktests
+
 all:
 	$(MAKE) -C src all
 
 clean:
 	$(MAKE) -C src clean
 
+install:
+	install -m755 -d $(dest)
+	install check $(dest)
+	cp -R tests common $(dest)
+	$(MAKE) -C src dest=$(dest)/src install
+
 # SC2119: "Use foo "$@" if function's $1 should mean script's $1". False
 # positives on helpers like _init_scsi_debug.
 SHELLCHECK_EXCLUDE := SC2119
@@ -13,4 +22,4 @@ check:
 		tests/*/rc tests/*/[0-9]*[0-9]
 	! grep TODO tests/*/rc tests/*/[0-9]*[0-9]
 
-.PHONY: all check
+.PHONY: all check install
diff --git a/README.md b/README.md
index be55aba..7967569 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,9 @@ Some tests require the following:
 - multipath-tools (Debian, openSUSE) or device-mapper-multipath (Fedora)
 - dmsetup (Debian) or device-mapper (Fedora, openSUSE, Arch Linux)
 
+Build blktests with `make install`. Optionally, install it to a known location
+with `make install`, `/usr/local/blktests` by default.
+
 Add the list of block devices you want to test on in a file named `config`:
 
 ```sh
diff --git a/src/Makefile b/src/Makefile
index 15c1022..b2bd321 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,10 +20,14 @@ all: $(TARGETS)
 clean:
 	rm -f $(TARGETS)
 
+install: $(TARGETS)
+	install -m755 -d $(dest)
+	install $(TARGETS) $(dest)
+
 $(C_TARGETS): %: %.c
 	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
 
 $(CXX_TARGETS): %: %.cpp
 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^
 
-.PHONY: all clean
+.PHONY: all clean install
-- 
2.18.1


  reply	other threads:[~2018-11-14 19:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 15:15 [PATCH blktests] makefile: Add install rule Gwendal Grignou
2018-11-14 18:26 ` Omar Sandoval
2018-11-14 19:37   ` Gwendal Grignou
2018-11-14 19:39     ` Gwendal Grignou [this message]
2018-11-14 19:46       ` [PATCH v2] " Omar Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181114193931.90009-1-gwendal@chromium.org \
    --to=gwendal@chromium.org \
    --cc=linux-block@vger.kernel.org \
    --cc=osandov@fb.com \
    --cc=osandov@osandov.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.