From 449c078661046665ba0cc87a0f632085a77df8a5 Mon Sep 17 00:00:00 2001 From: dweller Date: Thu, 16 Jan 2025 17:18:45 +0200 Subject: initial commit --- build.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 build.sh (limited to 'build.sh') 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 -- cgit v1.2.3