From 723e08b45e81cf1dda724c2b419d2542b70fd614 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Sat, 12 Jul 2025 20:47:18 -0400 Subject: [PATCH] Pass flags to clang and fix POSIX none-compliance Apple ships a real c99 as written in the standard. Lots of flags don't work. Just stay with cc instead. --- src/makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/makefile b/src/makefile index ed593e5..c9ed82f 100644 --- a/src/makefile +++ b/src/makefile @@ -95,15 +95,22 @@ CC=c99 endif # Test for GCC -ifneq (,$(findstring gcc,$(shell $(CC) 2>&1))) + +GCC=$(findstring gcc,$(shell $(CC) 2>&1)) +CLANG=$(findstring clang,$(shell $(CC) 2>&1)) + +ifneq (,$(or $(GCC), $(CLANG))) +CC=cc GCCFLAGS=-std=c99 -Wall -Wno-parentheses -fno-strict-aliasing -Wp,-D_FORTIFY_SOURCE=2 +ifneq (,$(GCC)) # link-time optimizer only on GCC 4.6+ GCC_VERSION_GT_46=$(shell expr `$(CC) -dumpversion` ">=" 4.6) ifeq ($(GCC_VERSION_GT_46),1) GCCFLAGS+= -flto=auto -ffat-lto-objects LDFLAGS=-flto=auto endif +endif endif