blob: 5f3d4940c8b741a40f4b4bbb933a783c048ff62a [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)
33 ./configure \
34 CPPFLAGS="-UNDEBUG" \
35 CFLAGS="-fsanitize=address -fsanitize=leak -fsanitize=undefined -Wall -Werror" \
Andrew Jefferyb18ab442017-05-29 16:41:30 +093036 --enable-code-coverage \
37 "$@"
Andrew Jeffery56b2aa32017-04-13 13:25:05 +093038 ;;
39 *)
40 echo 'Run "./configure ${CONFIGURE_FLAGS} && make"'
41 ;;
42esac