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

Signed-off-by: Gwendal Grignou <[email protected]>
---
 Makefile     | 9 +++++++++
 src/Makefile | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/Makefile b/Makefile
index 38b8ad1..d7c2b74 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) install
+
 # SC2119: "Use foo "$@" if function's $1 should mean script's $1". False
 # positives on helpers like _init_scsi_debug.
 SHELLCHECK_EXCLUDE := SC2119
diff --git a/src/Makefile b/src/Makefile
index 15c1022..f0ddbb5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,6 +20,9 @@ all: $(TARGETS)
 clean:
        rm -f $(TARGETS)
 
+install: $(TARGETS)
+       install $(TARGETS) $(dest)
+
 $(C_TARGETS): %: %.c
        $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
 
-- 
2.16.4

Reply via email to