diff options
| author | Albert Cervin <albert@acervin.com> | 2024-05-14 22:10:34 +0200 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2024-05-14 22:10:34 +0200 |
| commit | 36b3a04b9a2a9d52a1db6e28697e7ec3b1118eb1 (patch) | |
| tree | 7f4b6b5165afd2157dbb4f131f6a32f1fca82293 /configure | |
| parent | fd1728393d65abb8af2166f3697da55b338e0937 (diff) | |
| download | dged-36b3a04b9a2a9d52a1db6e28697e7ec3b1118eb1.tar.gz dged-36b3a04b9a2a9d52a1db6e28697e7ec3b1118eb1.tar.xz dged-36b3a04b9a2a9d52a1db6e28697e7ec3b1118eb1.zip | |
Improve configure with docs and help flag
Also make targets dependent on config.mk so that the program
is rebuilt when config.mk changes.
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -1,5 +1,49 @@ #!/bin/sh +_usage="./configure -- configure the DGED build. + +Options: + --[enable|disable]-syntax Enable or disable syntax highlighting support. + --enable-asan Build DGED with address sanitizer enabled. + -h/--help Show this help text. +" + +enable_syntax=1 +enable_asan=0 +while [ "$#" -gt 0 ]; do + case $1 in + --disable-syntax) + enable_syntax=0 + shift 1 + ;; + + --enable-syntax) + enable_syntax=1 + shift 1 + ;; + + --enable-asan) + enable_asan=1 + shift 1 + ;; + + -h|--help) + echo "$_usage" + exit + ;; + + -*) + echo "Unknown flag \"$1\". Usage:" + echo "$_usage" + exit 1 + ;; + *) + shift 1 + ;; + esac +done + + echo "/* Generated by configure */" > src/config.h echo "#ifndef _CONFIG_H" >> src/config.h echo "#define _CONFIG_H" >> src/config.h @@ -19,6 +63,20 @@ else echo "none." fi +if [ "$enable_syntax" -ne 0 ]; then + echo "enabling syntax highlighting" + echo "SYNTAX_ENABLE = true" >> config.mk +else + echo "disabling syntax highlighting" + echo "SYNTAX_ENABLE = false" >> config.mk +fi + +if [ "$enable_asan" -ne 0 ]; then + echo "enabling address sanitizer" + echo "ASAN = true" >> config.mk +fi + + echo "#endif" >> src/config.h echo "wrote src/config.h" echo "wrote config.mk" |
