From 759298cc3ca9a912b95dbbec60b13017e1d6ef38 Mon Sep 17 00:00:00 2001 From: HiGarfield Date: Tue, 21 Jan 2025 16:37:35 +0800 Subject: [PATCH] Automatically set NOFLAGS to 1 for C++ compilers --- src/Makefile | 3 +++ tests/Makefile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Makefile b/src/Makefile index b4cad7a7..a86a2947 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,6 +44,9 @@ override CFLAGS += -Wunsafe-loop-optimizations endif # $(CC) = gcc endif # CHECK = 1 +# Set NOFLAGS to 1 for C++ compilers +NOFLAGS := $(if $(findstring ++,$(CC)),1) + # If NOFLAGS is set to 1, set CFLAGS and LDFLAGS to empty ifeq ($(NOFLAGS),1) override CFLAGS := diff --git a/tests/Makefile b/tests/Makefile index 36f2775b..de890f92 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -44,6 +44,9 @@ override CFLAGS += -Wunsafe-loop-optimizations endif # $(CC) = gcc endif # CHECK = 1 +# Set NOFLAGS to 1 for C++ compilers +NOFLAGS := $(if $(findstring ++,$(CC)),1) + # If NOFLAGS is set to 1, set CFLAGS and LDFLAGS to empty ifeq ($(NOFLAGS),1) override CFLAGS :=