diff --git a/build.sh b/build.sh index c8414aa..daec5ee 100755 --- a/build.sh +++ b/build.sh @@ -35,7 +35,7 @@ $SRC if [ ! -f "kerep/bin/libkerep-$OS-$ARCH.a" ]; then echo "libkerep-$OS-$ARCH.a not found" cd kerep - ./build.sh + ./build.sh "$1" cd .. fi diff --git a/kerep/build.sh b/kerep/build.sh index fe59469..f3454f9 100755 --- a/kerep/build.sh +++ b/kerep/build.sh @@ -2,8 +2,15 @@ set -eo pipefail CMP="gcc" -WARN="-std=c11 -Wall -Wno-discarded-qualifiers -Wno-unused-parameter" -ARGS="-O2" +WARN="-std=c99 -Wall -Wextra -Wno-discarded-qualifiers -Wno-unused-parameter" +ARGS_DEBUG="-O0 -g" +ARGS_RELEASE="-O2 -flto=auto -fdata-sections -ffunction-sections -Wl,--gc-sections" +if [[ "$1" = "debug" ]]; then + ARGS=$ARGS_DEBUG +else + ARGS=$ARGS_RELEASE +fi + SRC="$(find src -name '*.c')" OS=$(../detect_os.sh)