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