summaryrefslogtreecommitdiff
path: root/.env/build.sh
diff options
context:
space:
mode:
Diffstat (limited to '.env/build.sh')
-rw-r--r--.env/build.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/.env/build.sh b/.env/build.sh
new file mode 100644
index 0000000..5846fd7
--- /dev/null
+++ b/.env/build.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -e
+
+CLANG_TIDY_FLAGS="
+ *,
+ -llvm-header-guard,
+ -readability-identifier-length
+ -readability-braces-around-statements
+ -readability-else-after-return
+ -readability-function-cognitive-complexity
+ -readability-magic-numbers
+ -cppcoreguidelines-init-variables
+ -cppcoreguidelines-avoid-non-const-global-variables
+ -cppcoreguidelines-avoid-magic-numbers
+ -bugprone-macro-parentheses
+ -bugprone-easily-swappable-parameters
+ -altera-unroll-loops
+ -altera-id-dependent-backward-branch
+ -llvm-else-after-return
+ -hicpp-braces-around-statements
+"
+
+CC_FLAGS="
+ --std=c89 \
+ -Werror=vla \
+
+ -Wall -Wpedantic -Wextra -pedantic-errors \
+ -Wswitch-enum \
+"
+CC_FLAGS+=" -Werror"
+
+CC_FLAGS+=" -I."
+
+CC_FLAGS+=" -O0 -g3 -march=native -fsanitize=array-bounds -fsanitize=bounds"
+#CC_FLAGS+=" -O3 -flto -g3 -march=native -fno-omit-frame-pointer" # for profiling
+#CC_FLAGS+=" -O3 -DNDEBUG -flto -march=native"
+
+CC_FLAGS+=" -Wgnu -Weverything -Wno-unsafe-buffer-usage \
+ -Wno-padded -Wno-covered-switch-default \
+ "
+
+#TARGET="examples/simple.c"
+TARGET="examples/c89.c"
+#clang-tidy $TARGET -checks="$CLANG_TIDY_FLAGS" -- $CC_FLAGS
+clang $CC_FLAGS $TARGET
+
+#clang -Os -nostdlib -ffreestanding -static -fno-stack-protector -fuse-ld=lld -I. examples/nolibc.c -o smallest
+