commit 48aa9dd528fd650ce6b177af3aee7b8b6762d342
parent bbd7c07d7279ac2cea038c21117f0f7c84772dea
Author: Jan Pobrislo <ccx@te2000.cz>
Date: Thu, 18 Dec 2025 19:51:31 +0000
Redesign configuration, write env variables into files based off make rules
Diffstat:
5 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/cc b/cc
@@ -1,5 +1,2 @@
#!/bin/sh -xe
-exec gcc -D_GNU_SOURCE -Werror \
- -pipe -std=c11 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections \
- "$@" -static
-# -Wall
+exec gcc -D_GNU_SOURCE -Werror -pipe -std=c11 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections "$@"
diff --git a/cc.configure b/cc.configure
@@ -0,0 +1,6 @@
+#!/bin/sh -xe
+cd "$(dirname "$0")"
+printf >cc.new '%s\n%s "$@"\n' '#!/bin/sh -xe' \
+ "exec ${CC:-gcc} ${CPPFLAGS} ${CFLAGS}"
+chmod +x cc.new
+mv cc.new cc
diff --git a/configure b/configure
@@ -0,0 +1,14 @@
+#!/bin/sh -xe
+cd "$(dirname "$0")"
+CPPFLAGS="-D_GNU_SOURCE ${CPPFLAGS-}"
+CFLAGS="-Werror -pipe -std=c11 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections ${CFLAGS-}"
+LDFLAGS="-static ${LDFLAGS-}"
+LDLIBS="-lskarnet ${LDLIBS-}"
+
+CPPFLAGS="${CPPFLAGS% }" ; export CPPFLAGS
+CFLAGS="${CFLAGS% }" ; export CFLAGS
+LDFLAGS="${LDFLAGS% }"; export LDFLAGS
+LDLIBS="${LDLIBS% }" ; export LDLIBS
+
+./cc.configure
+./link.configure
diff --git a/link b/link
@@ -1,2 +1,2 @@
#!/bin/sh -xe
-exec gcc -static "$@" -lskarnet
+exec gcc -static "$@" -lskarnet+
\ No newline at end of file
diff --git a/link.configure b/link.configure
@@ -1,7 +1,7 @@
#!/bin/sh -xe
cd "$(dirname "$0")"
-printf >link.new '%s\n%s' '#!/bin/sh -xe' 'exec gcc -static "$@"'
-printf >>link.new " '%s'" "$@"
-printf >>link.new '%s\n' ' -lskarnet'
+printf >link.new '%s\n%s "$@" %s' '#!/bin/sh -xe' \
+ "exec ${CC:-gcc} ${LDFLAGS}" \
+ "${LOADLIBES} ${LDLIBS}"
chmod +x link.new
mv link.new link