logo

utils-extra

Collection of extra tools for Unixes
commit: 0e654312111bf87a1189d354af1960fec26e746a
parent d4938e8c26569a0b2ffe8a33b29c6637eb691650
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 29 Jan 2024 11:58:23 +0100

Add LDSTATIC configuration option

Diffstat:

MMakefile6+++---
MREADME.md1+
Mconfigure4+++-
3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -7,7 +7,7 @@ all: $(EXE) .c: rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} - $(CC) -std=c99 $(CFLAGS) -o $@ $< $(LDFLAGS) + $(CC) -std=c99 $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDSTATIC) .c.o: rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} @@ -47,8 +47,8 @@ format: $(C_SOURCES) cmd/lolcat: cmd/lolcat.c Makefile rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} - $(CC) -std=c99 $(CFLAGS) -o $@ cmd/lolcat.c -lm $(LDFLAGS) + $(CC) -std=c99 $(CFLAGS) -o $@ cmd/lolcat.c -lm $(LDFLAGS) $(LDSTATIC) cmd/xcd: cmd/xcd.c Makefile rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} - $(CC) -std=c99 $(CFLAGS) -o $@ cmd/xcd.c -lm $(LDFLAGS) + $(CC) -std=c99 $(CFLAGS) -o $@ cmd/xcd.c -lm $(LDFLAGS) $(LDSTATIC) diff --git a/README.md b/README.md @@ -27,3 +27,4 @@ Tested on Linux(musl), FreeBSD, NetBSD, OpenBSD: <https://builds.sr.ht/~lanodan/ ## Packaging - The `./configure` script isn't auto*hell based, you can pass it arguments via key-value arguments or environment variables - You can define the `NO_BWRAP` environment variable to skip the bwrap-based tests which can cause issues in some environments like Gentoo `sandbox` +- If you want statically linked executables, define `LDSTATIC=-static` in the environment diff --git a/configure b/configure @@ -24,8 +24,9 @@ Variables: REUSE=BIN CFLAGS=OPTIONS - LDFLAGS=OPTIONS EXTRA_CFLAGS=OPTIONS + LDFLAGS=OPTIONS + LDSTATIC=OPTIONS Variables are set in the following order: Default, Environment, Arguments @@ -207,6 +208,7 @@ REUSE = ${REUSE} CFLAGS = ${CFLAGS} LDFLAGS = ${LDFLAGS} +LDSTATIC = ${LDSTATIC} EOF is_ok