Andrew Jeffery | 2277804 | 2017-01-13 22:37:26 +1030 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Andrew Jeffery | 57d608b | 2017-05-29 16:56:36 +0930 | [diff] [blame] | 3 | set -eu |
| 4 | |
Andrew Jeffery | 2277804 | 2017-01-13 22:37:26 +1030 | [diff] [blame] | 5 | AUTOCONF_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 Jeffery | b18ab44 | 2017-05-29 16:41:30 +0930 | [diff] [blame] | 9 | BOOTSTRAP_MODE="" |
| 10 | |
| 11 | if [ $# -gt 0 ]; |
| 12 | then |
| 13 | BOOTSTRAP_MODE="${1}" |
| 14 | shift 1 |
| 15 | fi |
| 16 | |
| 17 | case "${BOOTSTRAP_MODE}" in |
Andrew Jeffery | 2277804 | 2017-01-13 22:37:26 +1030 | [diff] [blame] | 18 | 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 Jeffery | b18ab44 | 2017-05-29 16:41:30 +0930 | [diff] [blame] | 26 | *) ;; |
Andrew Jeffery | 2277804 | 2017-01-13 22:37:26 +1030 | [diff] [blame] | 27 | esac |
| 28 | |
| 29 | autoreconf -i |
Andrew Jeffery | 56b2aa3 | 2017-04-13 13:25:05 +0930 | [diff] [blame] | 30 | |
Andrew Jeffery | b18ab44 | 2017-05-29 16:41:30 +0930 | [diff] [blame] | 31 | case "${BOOTSTRAP_MODE}" in |
Andrew Jeffery | 56b2aa3 | 2017-04-13 13:25:05 +0930 | [diff] [blame] | 32 | dev) |
Andrew Jeffery | 385b46e | 2017-05-29 16:42:14 +0930 | [diff] [blame^] | 33 | FLAGS="-fsanitize=address -fsanitize=leak -fsanitize=undefined -Wall -Werror" |
Andrew Jeffery | 56b2aa3 | 2017-04-13 13:25:05 +0930 | [diff] [blame] | 34 | ./configure \ |
| 35 | CPPFLAGS="-UNDEBUG" \ |
Andrew Jeffery | 385b46e | 2017-05-29 16:42:14 +0930 | [diff] [blame^] | 36 | CFLAGS="${FLAGS}" \ |
| 37 | CXXFLAGS="${FLAGS}" \ |
Andrew Jeffery | b18ab44 | 2017-05-29 16:41:30 +0930 | [diff] [blame] | 38 | --enable-code-coverage \ |
| 39 | "$@" |
Andrew Jeffery | 56b2aa3 | 2017-04-13 13:25:05 +0930 | [diff] [blame] | 40 | ;; |
| 41 | *) |
| 42 | echo 'Run "./configure ${CONFIGURE_FLAGS} && make"' |
| 43 | ;; |
| 44 | esac |