From 8a0a98d35e21f282088edf28b9e8da66ec390e3a Mon Sep 17 00:00:00 2001 From: John Meneghini Date: Thu, 21 Jun 2018 20:12:24 +0000 Subject: [PATCH] tools: githooks support for Freebsd - make the pre-push hook compile on FreeBSD Change-Id: Iaed344b263d7c817ceb102ec0ff8de9d4a663c95 Signed-off-by: John Meneghini Signed-off-by: Ed Rodriguez Reviewed-on: https://review.gerrithub.io/416461 Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris Tested-by: SPDK Automated Test System --- .githooks/pre-push | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index 6e57a1e9a..5775fb2da 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -14,17 +14,23 @@ # rc=0 +SYSTEM=`uname -s` # Redirect output to stderr. exec 1>&2 +if [ "$SYSTEM" = "FreeBSD" ]; then + MAKE="gmake MAKE=gmake -j ${nproc}" + COMP="clang" +else + MAKE="make -j ${nproc}" + COMP="gcc" +fi -MAKE="make -j ${nproc}" - -echo "Running make with gcc ..." -echo "make clean " > make.log +echo "Running make with $COMP ..." +echo "${MAKE} clean " > make.log $MAKE clean >> make.log 2>&1 -echo "make CONFIG_DEBUG=n CONFIG_WERROR=y " >> make.log +echo "${MAKE} CONFIG_DEBUG=n CONFIG_WERROR=y " >> make.log $MAKE CONFIG_DEBUG=n CONFIG_WERROR=y >> make.log 2>&1 rc=$? if [ $rc -ne 0 ]; then @@ -37,9 +43,9 @@ if [ $rc -ne 0 ]; then exit $rc fi -echo "make clean " >> make.log +echo "${MAKE} clean " >> make.log $MAKE clean >> make.log 2>&1 -echo "make CONFIG_DEBUG=y CONFIG_WERROR=y " >> make.log +echo "${MAKE} CONFIG_DEBUG=y CONFIG_WERROR=y " >> make.log $MAKE CONFIG_DEBUG=y CONFIG_WERROR=y >> make.log 2>&1 rc=$? if [ $rc -ne 0 ]; then @@ -66,9 +72,15 @@ if [ $rc -ne 0 ]; then exit $rc fi -echo "make clean " >> make.log +echo "$MAKE clean " >> make.log $MAKE clean >> make.log 2>&1 +if [ "$SYSTEM" = "FreeBSD" ]; then + echo + echo "Pushing to $1 $2" + exit $rc +fi + if ! hash clang 2>/dev/null; then echo "clang not found; skipping the clang tests" echo @@ -119,7 +131,7 @@ if [ $rc -ne 0 ]; then exit $rc fi -$MAKE clean CC=clang CXX=clang++ 2> /dev/null +${MAKE} clean CC=clang CXX=clang++ 2> /dev/null echo "Pushing to $1 $2"