diff mbox

add a build.sh helper to allow for a one-stop build

Message ID 1476113282-19194-1-git-send-email-hch@lst.de (mailing list archive)
State Superseded
Headers show

Commit Message

Christoph Hellwig Oct. 10, 2016, 3:28 p.m. UTC
This allows for a quick build instead of typing the whole mkdir, cd,
cmake and ninja sequence.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 README.md |  5 +----
 build.sh  | 12 ++++++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)
 create mode 100755 build.sh

Comments

Bart Van Assche Oct. 10, 2016, 3:56 p.m. UTC | #1
On 10/10/16 08:28, Christoph Hellwig wrote:
>  *build/bin* will contain the sample programs and *build/lib* will contain the
> diff --git a/build.sh b/build.sh
> new file mode 100755
> index 0000000..e3d85eb
> --- /dev/null
> +++ b/build.sh
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +SRCDIR=`dirname $0`
> +BUILDDIR="$SRCDIR/build"
> +
> +if [ ! -d "$BUILDDIR" ]; then
> +    mkdir $BUILDDIR
> +fi
> +
> +cd $BUILDDIR
> +cmake -GNinja ..
> +ninja

Hello Christoph,

Have you considered to make this script stop immediately if one of the 
steps fails, e.g. as follows?

mkdir -p "$BUILDDIR" &&
cd build &&
cmake -G Ninja .. &&
ninja

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig Oct. 10, 2016, 3:59 p.m. UTC | #2
On Mon, Oct 10, 2016 at 08:56:33AM -0700, Bart Van Assche wrote:
> Have you considered to make this script stop immediately if one of the 
> steps fails, e.g. as follows?

How about just ading a 

set -e

to the beginning to get this automatically?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche Oct. 10, 2016, 4:17 p.m. UTC | #3
On 10/10/16 08:59, Christoph Hellwig wrote:
> On Mon, Oct 10, 2016 at 08:56:33AM -0700, Bart Van Assche wrote:
>> Have you considered to make this script stop immediately if one of the
>> steps fails, e.g. as follows?
>
> How about just ading a
>
> set -e
>
> to the beginning to get this automatically?

That would also work. But if there is a space anywhere in the path in 
which the rdma-core repository exists, mkdir $BUILDDIR will have to be 
changed into mkdir "$BUILDDIR".

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/README.md b/README.md
index 98ec5a7..2ddecc3 100644
--- a/README.md
+++ b/README.md
@@ -36,10 +36,7 @@  Additional service daemons are provided for:
 This project uses a cmake based build system. Quick start:
 
 ```sh
-$ mkdir build
-$ cd build
-$ cmake -GNinja ..
-$ ninja
+$ sh build.sh
 ```
 
 *build/bin* will contain the sample programs and *build/lib* will contain the
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..e3d85eb
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,12 @@ 
+#!/bin/sh
+
+SRCDIR=`dirname $0`
+BUILDDIR="$SRCDIR/build"
+
+if [ ! -d "$BUILDDIR" ]; then
+    mkdir $BUILDDIR
+fi
+
+cd $BUILDDIR
+cmake -GNinja ..
+ninja