From aa737a2b2ea439957fe8a8478d7d04b1298e13bd Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Sat, 13 Jan 2024 14:41:15 -0500 Subject: [PATCH] Don't use c99 -MM -MT. These are non-POSIX flags that only work on some compilers. Notably, the BSD c99 executables don't support them. --- configure | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/configure b/configure index a313bf3..38a30cf 100755 --- a/configure +++ b/configure @@ -128,11 +128,26 @@ print_obj() { printf '%s ' "$2" } +get_deps() { + src="$1" + + ${CC} -I${INCLUDE} -E "$src" \ + | grep '^#' \ + | awk '{print $3}' \ + | cut -d '"' -f 2 \ + | sort \ + | uniq \ + | grep -v '^[/<]' \ + | while IFS= read -r dep; do + printf "%s " "$dep" + done +} + compile_obj() { src="$1" obj="$2" - ${CC} -I${INCLUDE} -MM -MT "${obj}" "${src}" + echo "${obj}: $(get_deps ${src})" echo "${TAB}@mkdir -p $(dirname ${obj})" echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${src}\"" }