#!/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