diff options
Diffstat (limited to 'build.sh')
-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 |