forked from lda/telodendria
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.
This commit is contained in:
parent
8b8873103d
commit
71a0181a6a
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue