diff options
| author | iamcheeseman <[email protected]> | 2026-05-25 15:47:08 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-05-25 15:47:08 -0400 |
| commit | 8122098e3854bf68ca63cc25e082ba51a27b8615 (patch) | |
| tree | 471e7191211b0f66f1c7c7c4c81cf2589e6f3c8d /build.sh | |
| parent | 1fb9ed0d6f627662f8d001afa761860d63d9f4a2 (diff) | |
I realized that Makefiles are dumb
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..51dbc6e --- /dev/null +++ b/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +source build.env + +INC="-Iteensy -Iteensy/platform/$PLATFORM -Idc" +CFLAGS="$INC -Wall -Wextra -pedantic -std=c99 -D_XOPEN_SOURCE=700 -O2" +LDFLAGS=-lm + +DO_RUN=0 + +for flag in $@; do + case $flag in + 'debug') + CFLAGS="$DBFLAGS $CFLAGS" + ;; + 'run') + DO_RUN=1 + ;; + esac +done + +if [ "$PLATFORM" == 'gl' ]; then + CFLAGS="$CFLAGS $(pkg-config --cflags glfw3 gl)" + LDFLAGS="$LDFLAGS $(pkg-config --libs glfw3 gl)" +fi + +SRC=$(find dc teensy platform/$PLATFORM -name '*.c' | tr '\n' ' ') + +CMD="$CC -o $OUT $CFLAGS $LDFLAGS $SRC" +echo $CMD +time eval $CC -o $OUT $CFLAGS $LDFLAGS $SRC + +[ "$DO_RUN" -eq 1 ] && $RUN_CMD ./$OUT |
