diff options
author | midipix <writeonce@midipix.org> | 2018-12-25 09:53:32 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-12-25 09:54:47 -0500 |
commit | 99b9ed78fc4a926c81a71b3fd8c0ff634a5f1a08 (patch) | |
tree | f2037c8e1591be0c93d91b36e731bace7140f008 | |
parent | 9cc783e8a004b3d9e095e2c7eedaa9652ce93f2e (diff) | |
download | ntux-99b9ed78fc4a926c81a71b3fd8c0ff634a5f1a08.tar.bz2 ntux-99b9ed78fc4a926c81a71b3fd8c0ff634a5f1a08.tar.xz |
build system: configure: handle fatal errors more gracefully.
-rwxr-xr-x | configure | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -2,6 +2,8 @@ set -eu +trap config_failure 1 2 EXIT + usage() { cat "$mb_project_dir"/config.usage @@ -182,6 +184,8 @@ verify_build_directory() mb_project_dir='.' fi fi + + rm -f Makefile Makefile.host Makefile.tmp Makefile.failed } @@ -682,6 +686,26 @@ config_status() printf "\nconfiguration completed successfully.\n\n" } + +config_failure() +{ + if [ -f Makefile ]; then + mb_error='failed to use the generated Makefile.' + printf '\n%s: error: %s\n' "${0}" "$mb_error" >&2 + mv Makefile Makefile.failed + fi + + exit 2 +} + + +config_success() +{ + trap '' EXIT + exit 0 +} + + # one: init init_vars verify_build_directory @@ -942,4 +966,4 @@ config_status # all done -exit 0 +config_success |