From 1ee2662ab52c2d03cc3b818713084959a110fb68 Mon Sep 17 00:00:00 2001
From: Steffen Jaeckel <s@jaeckel.eu>
Date: Tue, 13 Jun 2017 17:48:21 +0200
Subject: [PATCH] only run scan_build.sh once

---
 scan_build.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scan_build.sh b/scan_build.sh
index c7395ff..05d4fde 100755
--- a/scan_build.sh
+++ b/scan_build.sh
@@ -1,6 +1,11 @@
 #!/bin/bash
 [ "$TRAVIS_CI" != "" ] && { [ -z "$(which scan-build)" ] && { echo "installing clang"; sudo apt-get install clang -y -qq; }; } || true
 
+if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
+    echo "only run $0 for the regular makefile, early exit success"
+    exit 0
+fi
+
 # output version
 bash printinfo.sh
 
@@ -9,4 +14,4 @@ make clean > /dev/null
 scan_build=$(which scan-build)
 [ -z "$scan_build" ] && scan_build=$(find /usr/bin/ -name 'scan-build-*' | sort -nr | head -n1) || true
 [ -z "$scan_build" ] && { echo "couldn't find clang scan-build"; exit 1; } || true
-$scan_build make -f makefile.unix all CFLAGS="" EXTRALIBS=""
+CFLAGS="" EXTRALIBS="" $scan_build make -f makefile.unix all CFLAGS="" EXTRALIBS=""