FLTO ?= 0
FPGO ?= 0
STRIP ?= 0
-MARCH ?= native
-MTUNE ?= native
+CPU ?= 0
+MARCH ?= 0
+MTUNE ?= 0
# ---------------------------------------------------------------------------
# Directories
CONFIG =
LDFLGS =
-CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall -march=$(MARCH) -mtune=$(MTUNE)
+CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall
+
+ifneq ($(CPU),0)
+ CFLAGS += -m$(firstword $(CPU))
+endif
+ifneq ($(MARCH),0)
+ CFLAGS += -march=$(firstword $(MARCH))
+endif
+ifneq ($(MTUNE),0)
+ CFLAGS += -mtune=$(firstword $(MTUNE))
+endif
ifneq ($(ASAN),0)
CONFIG := _a
CFLAGS += -flto -fuse-linker-plugin
endif
ifneq ($(FPGO),0)
- CFLAGS += -fprofile-$(FPGO)
+ CFLAGS += -fprofile-$(firstword $(FPGO))
endif
endif
ifneq ($(NALYZE),0)
MACHINE := $(shell $(CC) -dumpmachine)
-ifneq ($(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)),)
+ifeq ($(MACHINE),$(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)))
SUFFIX := .exe
else
SUFFIX :=
endif
-ifeq ($(filter %mingw32 %-windows-gnu,$(MACHINE)),)
+ifneq ($(MACHINE),$(filter %mingw32 %-windows-gnu,$(MACHINE)))
LDFLGS += -lpthread
endif
LDFLGS += -static
endif
-ifneq ($(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE)),)
+ifeq ($(MACHINE),$(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE)))
LDFLGS += -mconsole -municode
endif