diff mbox series

[blktests] makefile: Add install rule

Message ID 20181109151524.50405-1-gwendal@chromium.org (mailing list archive)
State New, archived
Headers show
Series [blktests] makefile: Add install rule | expand

Commit Message

Gwendal Grignou Nov. 9, 2018, 3:15 p.m. UTC
Add rule to install to a target directory, /usr/local/blktests by
default.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 Makefile     | 9 +++++++++
 src/Makefile | 3 +++
 2 files changed, 12 insertions(+)

Comments

Omar Sandoval Nov. 14, 2018, 6:26 p.m. UTC | #1
On Fri, Nov 09, 2018 at 07:15:24AM -0800, Gwendal Grignou wrote:
> Add rule to install to a target directory, /usr/local/blktests by
> default.

This seems reasonale, but I'm curious, what's your use case?

> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  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 should be added to the .PHONY targets.

> +	install -m755 -d $(dest)
> +	install check $(dest)
> +	cp -R tests common $(dest)
> +	$(MAKE) -C src dest=$(dest) install

The src programs need to be installed to $(dest)/src.

>  # 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 $@ $^

This ability to install tests could also use a mention in the README.
Gwendal Grignou Nov. 14, 2018, 7:37 p.m. UTC | #2
On Wed, Nov 14, 2018 at 10:26 AM Omar Sandoval <osandov@osandov.com> wrote:
>
> On Fri, Nov 09, 2018 at 07:15:24AM -0800, Gwendal Grignou wrote:
> > Add rule to install to a target directory, /usr/local/blktests by
> > default.
>
> This seems reasonale, but I'm curious, what's your use case?
I will use blktest to check chromebooks kernel. ChromeOS is using
Gentoo tool like emerge to [cros-]compile a package that is then
integrated in a [test] image.
You can see the ebuild I am currently using for building a blktest
package at https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1329948
It needs an install rule to move the tests and common file from the
source directory to the destination directory we will use to produce
an image.

Thans,

Gwendal.
>
> > Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> > ---
> >  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 should be added to the .PHONY targets.
done
>
> > +     install -m755 -d $(dest)
> > +     install check $(dest)
> > +     cp -R tests common $(dest)
> > +     $(MAKE) -C src dest=$(dest) install
>
> The src programs need to be installed to $(dest)/src.
done
>
> >  # 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 $@ $^
>
> This ability to install tests could also use a mention in the README.
done
diff mbox series

Patch

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 $@ $^