summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh15
1 files changed, 14 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 2cce5bb..bf4b3d8 100755
--- a/build.sh
+++ b/build.sh
@@ -1,3 +1,16 @@
#!/bin/bash
CC=gcc
-$CC -o toc main.c -O0 -g3 -Wall -Wextra -Wpedantic -Wconversion -Wshadow -std=c11 || exit 1
+
+# Possible extra build flags
+# these are for compiling the compiler, and NOT for compiling the program itself.
+# -DNONZERO_NULL_PTRS
+# - must be set if the zero value of a pointer (as might be set by calloc/memset)
+# is not the NULL pointer.
+
+ADDITIONAL_FLAGS=
+
+WARNINGS='-Wall -Wextra -Wpedantic -Wconversion -Wshadow'
+DEBUG_FLAGS="-O0 -g3 $WARNINGS -std=c11"
+RELEASE_FLAGS="-O3 -DNDEBUG $WARNINGS -std=c11"
+
+$CC $DEBUG_FLAGS $ADDITIONAL_FLAGS -o toc main.c || exit 1