Small Makefile improvement.

This commit is contained in:
LoRd_MuldeR 2021-04-19 22:21:07 +02:00
parent b7e32f5f0a
commit acc52ce8d8
Signed by: mulder
GPG Key ID: 2B5913365F57E03F

View File

@ -9,8 +9,9 @@ STATIC ?= 0
FLTO ?= 0 FLTO ?= 0
FPGO ?= 0 FPGO ?= 0
STRIP ?= 0 STRIP ?= 0
MARCH ?= native CPU ?= 0
MTUNE ?= native MARCH ?= 0
MTUNE ?= 0
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Directories # Directories
@ -25,7 +26,17 @@ SUBDIR_LIB := libslunkcrypt
CONFIG = CONFIG =
LDFLGS = 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) ifneq ($(ASAN),0)
CONFIG := _a CONFIG := _a
@ -39,7 +50,7 @@ ifneq ($(FLTO),0)
CFLAGS += -flto -fuse-linker-plugin CFLAGS += -flto -fuse-linker-plugin
endif endif
ifneq ($(FPGO),0) ifneq ($(FPGO),0)
CFLAGS += -fprofile-$(FPGO) CFLAGS += -fprofile-$(firstword $(FPGO))
endif endif
endif endif
ifneq ($(NALYZE),0) ifneq ($(NALYZE),0)
@ -48,13 +59,13 @@ endif
MACHINE := $(shell $(CC) -dumpmachine) MACHINE := $(shell $(CC) -dumpmachine)
ifneq ($(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)),) ifeq ($(MACHINE),$(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)))
SUFFIX := .exe SUFFIX := .exe
else else
SUFFIX := SUFFIX :=
endif endif
ifeq ($(filter %mingw32 %-windows-gnu,$(MACHINE)),) ifneq ($(MACHINE),$(filter %mingw32 %-windows-gnu,$(MACHINE)))
LDFLGS += -lpthread LDFLGS += -lpthread
endif endif
@ -66,7 +77,7 @@ ifeq ($(STATIC),1)
LDFLGS += -static LDFLGS += -static
endif endif
ifneq ($(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE)),) ifeq ($(MACHINE),$(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE)))
LDFLGS += -mconsole -municode LDFLGS += -mconsole -municode
endif endif