aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMosder <git@mosder.eu>2026-10-20 14:44:33 +0200
committerMosder <git@mosder.eu>2026-10-20 14:44:33 +0200
commitfc5f5f1f58542500734841822768267d0ece2456 (patch)
tree0501e3d718338094f58f5e6af1232ee4900372b2 /Makefile
parentec315985c9f51c932b1177539c43a024bf58207d (diff)
feat: improved support for windows. added gating behind _WIN32 to use _ prefixed versions of functions and made it work (with limited functionality) on machines without fileno
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index ae8a59e..044e2b4 100644
--- a/Makefile
+++ b/Makefile
@@ -29,12 +29,18 @@ endef
PROBED:= \
$(call probe_fun,string.h,memmem) \
- $(call probe_fun,string.h,strdup) \
- $(call probe_fun,stdio.h,fileno)
+ $(call probe_fun,string.h,strdup)
CFLAGS+=$(PROBED)
TESTS_CFLAGS+=$(PROBED)
+FS_FLAG:=$(shell printf '#include "compat.h"\n#include <stdio.h>\nint main(void){\n#ifdef _WIN32\n_fileno;\n#else\nfileno;\n#endif\nreturn 0;}' \
+ | $(CC) $(CFLAGS) -x c - -o /dev/null 2>/dev/null \
+ || echo -DNO_FS)
+
+CFLAGS+=$(FS_FLAG)
+TESTS_CFLAGS+=$(FS_FLAG)
+
both: CLEANUP=true
both: clean shared static
@$(MAKE) clean --no-print-directory