diff options
author | dweller <dweller@cabin.digital> | 2025-01-16 17:18:45 +0200 |
---|---|---|
committer | dweller <dweller@cabin.digital> | 2025-01-16 17:18:45 +0200 |
commit | 449c078661046665ba0cc87a0f632085a77df8a5 (patch) | |
tree | f28f961cf2c07e37fb77e34a882e5ba87e411eb3 /build.sh |
Diffstat (limited to '')
-rwxr-xr-x | build.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..88b193b --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/sh -e + +CC=${CC:-gcc} +STATIC=${STATIC:-} +DEBUGFLAGS=${OPTFLAGS:-"-Og -g"} +FASTFLAGS=${OPTFLAGS:-"-O3 -flto -fwhole-program -ffunction-sections -fdata-sections -Wl,--gc-sections"} + +CFLAGS=" \ + -Wall -Wextra -Wpedantic -Wshadow \ + -Wno-long-long \ + -std=c89 \ + $STATIC \ + -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \ +" + +case "$1" in + "help") + >&2 echo "Usage: $0 [help|fast|debug]" + >&2 echo " fast/debug - add optimization or debug flags" + exit 1 + ;; + "fast") CFLAGS="$CFLAGS $FASTFLAGS" ;; + "debug"|*) CFLAGS="$CFLAGS $DEBUGFLAGS" ;; +esac + +$CC $CFLAGS urltool.c -o urltool +ln -rsf urltool urldec +ln -rsf urltool urlenc |