From 71a0181a6a417ad9661f495dae5e6acd8e46574a Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Sun, 5 Feb 2023 14:46:20 +0000 Subject: [PATCH] Break out static options into an environment variable. This allows users to turn off static compilation if the compiler or linker throws a fit about it. Looking at you, Glibc. And PCC doesn't seem to like static compilation either; it generates a binary that just segfaults immediately on executation. --- tools/bin/td | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/bin/td b/tools/bin/td index 81d47e9..bea2953 100644 --- a/tools/bin/td +++ b/tools/bin/td @@ -26,12 +26,14 @@ : "${CC:=cc}" : "${CFLAGS:=-Wall -Wextra -pedantic -ansi -O3}" -: "${LDFLAGS:=-lm -pthread -static -flto -fdata-sections -ffunction-sections -s -Wl,-static -Wl,-gc-sections}" +: "${STATIC:=-static -Wl,-static}" +: "${LDFLAGS:=-lm -pthread -flto -fdata-sections -ffunction-sections -s -Wl,-gc-sections}" : "${PROG:=telodendria}" . "$(pwd)/tools/lib/common.sh" CFLAGS="${CFLAGS} ${DEFINES} ${INCLUDES}" +LDFLAGS="${LDFLAGS} ${STATIC}" if [ "$DEBUG" = "1" ]; then CFLAGS="$CFLAGS -O0 -g" @@ -86,6 +88,11 @@ recipe_build() { cd src mkdir -p ../build + echo "CC = ${CC}" + echo "CFLAGS = ${CFLAGS}" + echo "LDFLAGS = ${LDFLAGS}" + echo + do_rebuild=0 objs="" for src in $(find . -name '*.c' | cut -d '/' -f 2-); do