blob: 90a69513da6711280f1f0326ea3834c7e00834b2 [file] [log] [blame]
Andrew Jeffery22778042017-01-13 22:37:26 +10301#!/bin/sh
2
Andrew Jeffery57d608b2017-05-29 16:56:36 +09303set -eu
4
Andrew Jeffery22778042017-01-13 22:37:26 +10305AUTOCONF_FILES="Makefile.in aclocal.m4 ar-lib autom4te.cache compile \
6 config.guess config.h.in config.sub configure depcomp install-sh \
7 ltmain.sh missing *libtool test-driver"
8
Andrew Jefferyb18ab442017-05-29 16:41:30 +09309BOOTSTRAP_MODE=""
10
11if [ $# -gt 0 ];
12then
13 BOOTSTRAP_MODE="${1}"
14 shift 1
15fi
16
17case "${BOOTSTRAP_MODE}" in
Andrew Jeffery22778042017-01-13 22:37:26 +103018 clean)
19 test -f Makefile && make maintainer-clean
20 test -d linux && find linux -type d -empty | xargs -r rm -rf
21 for file in ${AUTOCONF_FILES}; do
22 find -name "$file" | xargs -r rm -rf
23 done
24 exit 0
25 ;;
Andrew Jefferyb18ab442017-05-29 16:41:30 +093026 *) ;;
Andrew Jeffery22778042017-01-13 22:37:26 +103027esac
28
29autoreconf -i
Andrew Jeffery56b2aa32017-04-13 13:25:05 +093030
Andrew Jefferyb18ab442017-05-29 16:41:30 +093031case "${BOOTSTRAP_MODE}" in
Andrew Jeffery56b2aa32017-04-13 13:25:05 +093032 dev)
Andrew Jeffery385b46e2017-05-29 16:42:14 +093033 FLAGS="-fsanitize=address -fsanitize=leak -fsanitize=undefined -Wall -Werror"
Andrew Jeffery56b2aa32017-04-13 13:25:05 +093034 ./configure \
35 CPPFLAGS="-UNDEBUG" \
Andrew Jeffery385b46e2017-05-29 16:42:14 +093036 CFLAGS="${FLAGS}" \
37 CXXFLAGS="${FLAGS}" \
Andrew Jefferyb18ab442017-05-29 16:41:30 +093038 --enable-code-coverage \
39 "$@"
Andrew Jeffery56b2aa32017-04-13 13:25:05 +093040 ;;
41 *)
42 echo 'Run "./configure ${CONFIGURE_FLAGS} && make"'
43 ;;
44esac