summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-25 20:40:54 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-25 20:40:54 -0500
commitf39b2c39bd8f5eff3e8e49271d8ff27e3d81c186 (patch)
tree6300ae12ca48c26606d590ac91f40f34eac79e6e /configure
parent9cc24b4b7652b490020c7db83f72a38ae96d6384 (diff)
finally got a decent thing to select C, POSIX, and X/Open versions
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure47
1 files changed, 46 insertions, 1 deletions
diff --git a/configure b/configure
index 5675284a..ac387ba4 100755
--- a/configure
+++ b/configure
@@ -136,16 +136,61 @@ elif [ -n "${posix}" ]; then
printf 'CFLAGS=-D_POSIX_C_SOURCE=%d\n' "${posix}" >> .config.mk
fi
+
+### generate .build.mk
cat <<EOF > .build.mk
.POSIX:
+
+# work-around GNU ar's default "deterministic" mode
+ARFLAGS=rvU
+
default: all
include .config.mk
include \$(TOPDIR)/.deps.mk
-all: libc.a
EOF
+rm -f .build.all.mk
+
+for lib in $(ls $(dirname $0)/.deps/lib* | sed -e 's#^.*/\(lib.*\)\..*$#\1#g' | grep -v '\.h$' | sort -u); do
+ printf '%s.a:' "${lib}"
+
+ for cver in $(ls $(dirname $0)/.deps/${lib}.C_* 2>/dev/null | sed -e 's#^.*\.C_##g'); do
+ if [ $cver -le ${standard_c:-1} ]; then
+ printf ' $(%s_C_%d_OBJS)' "${lib}" "${cver}"
+ printf '%s\n' "${lib}" >> .build.all.mk
+ fi
+ done
+
+ for pver in $(ls $(dirname $0)/.deps/${lib}.POSIX_* 2>/dev/null | sed -e 's#^.*\.POSIX_##g'); do
+ if [ $pver -le ${posix:-0} ]; then
+ printf ' $(%s_POSIX_%d_OBJS)' "${lib}" "${pver}"
+ printf '%s\n' "${lib}" >> .build.all.mk
+ fi
+ done
+
+ for xver in $(ls $(dirname $0)/.deps/${lib}.XOPEN_* 2>/dev/null | sed -e 's#^.*\.XOPEN_##g'); do
+ if [ $xver -le ${xopen:-0} ]; then
+ printf ' $(%s_XOPEN_%d_OBJS)' "${lib}" "${xver}"
+ printf '%s\n' "${lib}" >> .build.all.mk
+ fi
+ done
+
+ printf '\n\t$(AR) $(ARFLAGS) $@ $^\n\n'
+done >> .build.mk
+
+printf 'all:' >> .build.mk
+sort -u .build.all.mk | awk '{printf(" %s.a", $0);}' >> .build.mk
+printf '\n' >> .build.mk
+rm -f .build.all.mk
+
+for i in $libs; do
+ echo $i
+done >> .build.mk
+
+### generate main Makefile
+### FIXME: this can probably be kept as a fixed file
cat <<EOF > Makefile
.POSIX:
.DEFAULT:;\$(MAKE) all