build: Update build scripts

Change-Id: Ifad7ff5004a4dede8beec348e9920453fc74449d
diff --git a/.jenkins.d/20-ndns.sh b/.jenkins.d/20-ndns.sh
index 1d9ee2a..b47b93b 100755
--- a/.jenkins.d/20-ndns.sh
+++ b/.jenkins.d/20-ndns.sh
@@ -1,41 +1,44 @@
 #!/usr/bin/env bash
-set -x
 set -e
 
 JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 source "$JDIR"/util.sh
 
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
+set -x
 
-# Configure/build in debug mode
-./waf -j1 --color=yes configure --with-tests --debug
-./waf -j1 --color=yes build
+git submodule init
+git submodule sync
+git submodule update
 
 # Cleanup
 sudo ./waf -j1 --color=yes distclean
 
-# Configure/build in optimized mode without tests
-./waf -j1 --color=yes configure
-./waf -j1 --color=yes build
+if [[ "$JOB_NAME" != *"limited-build" ]]; then
+  # Configure/build in optimized mode with tests
+  ./waf -j1 --color=yes configure --with-tests
+  ./waf -j1 --color=yes build
 
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
+  # Cleanup
+  sudo ./waf -j1 --color=yes distclean
 
-# Configure/build in debug mode
+  # Configure/build in optimized mode without tests
+  ./waf -j1 --color=yes configure
+  ./waf -j1 --color=yes build
+
+  # Cleanup
+  sudo ./waf -j1 --color=yes distclean
+fi
+
+# Configure/build in debug mode with tests
 if [[ "$JOB_NAME" == *"code-coverage" ]]; then
     COVERAGE="--with-coverage"
+elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
+    ASAN="--with-sanitizer=address"
 fi
-./waf -j1 --color=yes configure --debug --with-tests $COVERAGE
+./waf -j1 --color=yes configure --debug --with-tests $COVERAGE $ASAN
 ./waf -j1 --color=yes build
 
 # (tests will be run against debug version)
 
 # Install
 sudo ./waf -j1 --color=yes install
-
-if has Linux $NODE_LABELS; then
-    sudo ldconfig
-elif has FreeBSD $NODE_LABELS; then
-    sudo ldconfig -a
-fi