-- remove -D_POSIX_C_SOURCE=200809L, see https://github.com/LostRuins/koboldcpp/issues/2651
-- remove -march=native and -mtune=native

--- Makefile.orig	2026-11-02 03:39:16 UTC
+++ Makefile
@@ -64,8 +64,8 @@ endif
 #
 
 # keep standard at C11 and C++17
-CFLAGS =
-CXXFLAGS =
+CFLAGS = $(PRESET_CFLAGS)
+CXXFLAGS = $(PRESET_CXXFLAGS)
 ifdef KCPP_DEBUG
 CFLAGS = -g -O0
 CXXFLAGS = -g -O0
@@ -205,10 +205,10 @@ else
 endif # LLAMA_NOAVX2
 endif # LLAMA_NOAVX1
 else
-CFLAGS += -march=native -mtune=native
-SIMPLECFLAGS += -march=native -mtune=native
-SIMPLERCFLAGS += -march=native -mtune=native
-FULLCFLAGS += -march=native -mtune=native
+#CFLAGS += -march=native -mtune=native
+#SIMPLECFLAGS += -march=native -mtune=native
+#SIMPLERCFLAGS += -march=native -mtune=native
+#FULLCFLAGS += -march=native -mtune=native
 endif # LLAMA_PORTABLE
 endif # if x86
 
@@ -280,7 +280,7 @@ else
 NVCCFLAGS += -Wno-deprecated-gpu-targets -arch=all
 
 else
-NVCCFLAGS += -arch=native
+#NVCCFLAGS += -arch=native
 endif
 
 ifdef LLAMA_CUDA_CCBIN
@@ -417,15 +417,15 @@ ifneq ($(findstring clang, $(CCV)), )
 # sve is cooked on termux so we are disabling it
 ifeq ($(UNAME_O), Android)
 ifneq ($(findstring clang, $(CCV)), )
-CFLAGS += -mcpu=native+nosve
-CXXFLAGS += -mcpu=native+nosve
+#CFLAGS += -mcpu=native+nosve
+#CXXFLAGS += -mcpu=native+nosve
 else
-CFLAGS += -mcpu=native
-CXXFLAGS += -mcpu=native
+#CFLAGS += -mcpu=native
+#CXXFLAGS += -mcpu=native
 endif
 else
-CFLAGS += -mcpu=native
-CXXFLAGS += -mcpu=native
+#CFLAGS += -mcpu=native
+#CXXFLAGS += -mcpu=native
 endif
 endif
 endif
@@ -839,11 +839,11 @@ otherarch/audiocpp/upstream/%.o: otherarch/audiocpp/up
 otherarch/audiocpp/upstream/external/cJSON/cJSON.o otherarch/audiocpp/upstream/src/framework/io/json.o: Makefile
 otherarch/audiocpp/upstream/src/framework/model_spec/package.o: otherarch/audiocpp/upstream/generated/model_specs.inc
 otherarch/audiocpp/upstream/%.o: otherarch/audiocpp/upstream/%.cpp
-	$(CXX) -DCJSON_HIDE_SYMBOLS -D_USE_INTERNAL_STRING_VIEW -DHAVE_PTHREAD=1 -D_POSIX_C_SOURCE=200809L -DYAML_DECLARE_STATIC=1 -DYAML_VERSION_MAJOR=0 -DYAML_VERSION_MINOR=2 -DYAML_VERSION_PATCH=5 -DYAML_VERSION_STRING=\"0.2.5\" $(CXXFLAGS) -c $< -o $@
+	$(CXX) -DCJSON_HIDE_SYMBOLS -D_USE_INTERNAL_STRING_VIEW -DHAVE_PTHREAD=1 -DYAML_DECLARE_STATIC=1 -DYAML_VERSION_MAJOR=0 -DYAML_VERSION_MINOR=2 -DYAML_VERSION_PATCH=5 -DYAML_VERSION_STRING=\"0.2.5\" $(CXXFLAGS) -c $< -o $@
 otherarch/audiocpp/upstream/%.o: otherarch/audiocpp/upstream/%.cc
-	$(CXX) -DCJSON_HIDE_SYMBOLS -D_USE_INTERNAL_STRING_VIEW -DHAVE_PTHREAD=1 -D_POSIX_C_SOURCE=200809L -DYAML_DECLARE_STATIC=1 -DYAML_VERSION_MAJOR=0 -DYAML_VERSION_MINOR=2 -DYAML_VERSION_PATCH=5 -DYAML_VERSION_STRING=\"0.2.5\" $(CXXFLAGS) -c $< -o $@
+	$(CXX) -DCJSON_HIDE_SYMBOLS -D_USE_INTERNAL_STRING_VIEW -DHAVE_PTHREAD=1 -DYAML_DECLARE_STATIC=1 -DYAML_VERSION_MAJOR=0 -DYAML_VERSION_MINOR=2 -DYAML_VERSION_PATCH=5 -DYAML_VERSION_STRING=\"0.2.5\" $(CXXFLAGS) -c $< -o $@
 otherarch/audiocpp/upstream/%.o: otherarch/audiocpp/upstream/%.c
-	$(CC) -DCJSON_HIDE_SYMBOLS -D_POSIX_C_SOURCE=200809L -DYAML_DECLARE_STATIC=1 -DYAML_VERSION_MAJOR=0 -DYAML_VERSION_MINOR=2 -DYAML_VERSION_PATCH=5 -DYAML_VERSION_STRING=\"0.2.5\" $(CFLAGS) -c $< -o $@
+	$(CC) -DCJSON_HIDE_SYMBOLS -DYAML_DECLARE_STATIC=1 -DYAML_VERSION_MAJOR=0 -DYAML_VERSION_MINOR=2 -DYAML_VERSION_PATCH=5 -DYAML_VERSION_STRING=\"0.2.5\" $(CFLAGS) -c $< -o $@
 
 tts_default.o: otherarch/tts_adapter.cpp otherarch/audiocpp/upstream/generated/kcpp_tts_registry_headers.inc otherarch/audiocpp/upstream/generated/kcpp_tts_registry_loaders.inc otherarch/ttscpp/src/ttscpp.cpp otherarch/ttscpp/src/ttstokenizer.cpp otherarch/ttscpp/src/ttssampler.cpp otherarch/ttscpp/src/parler_model.cpp otherarch/ttscpp/src/dac_model.cpp otherarch/ttscpp/src/ttsutil.cpp otherarch/ttscpp/src/ttsargs.cpp otherarch/ttscpp/src/ttst5_encoder_model.cpp otherarch/ttscpp/src/phonemizer.cpp otherarch/ttscpp/src/tts_model.cpp otherarch/ttscpp/src/kokoro_model.cpp otherarch/ttscpp/src/dia_model.cpp otherarch/ttscpp/src/orpheus_model.cpp otherarch/ttscpp/src/snac_model.cpp otherarch/ttscpp/src/general_neural_audio_codec.cpp
 	$(CXX) $(CXXFLAGS) -c $< -o $@
