Small Makefile improvement.

This commit is contained in:
LoRd_MuldeR 2022-09-11 14:12:03 +02:00
parent 8d1fcca4ff
commit eb3f56e210

View File

@ -1,5 +1,8 @@
MACHINE := $(shell $(CC) -dumpmachine || echo unknown) MACHINE := $(shell $(CC) -dumpmachine || echo unknown)
STATIC ?= 1
STRIP ?= 1
ifneq (,$(firstword $(filter x86_64-%,$(MACHINE)))) ifneq (,$(firstword $(filter x86_64-%,$(MACHINE))))
MARCH ?= x86-64 MARCH ?= x86-64
MTUNE ?= nocona MTUNE ?= nocona
@ -12,6 +15,10 @@ endif
CFLAGS = -Wall -std=gnu99 -O3 -DNDEBUG CFLAGS = -Wall -std=gnu99 -O3 -DNDEBUG
ifneq (,$(XCFLAGS))
CFLAGS += $(XCFLAGS)
endif
ifneq (,$(MARCH)) ifneq (,$(MARCH))
CFLAGS += -march=$(MARCH) CFLAGS += -march=$(MARCH)
endif endif
@ -29,9 +36,14 @@ ifneq (,$(firstword $(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE))))
CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -mconsole -municode CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -mconsole -municode
endif endif
CFLAGS += -s -static ifeq ($(STATIC),1)
CFLAGS += -static
endif
.PHONY: all .PHONY: all
all: all:
$(CC) $(CFLAGS) -o $(OUTNAME) crc64.c $(CC) $(CFLAGS) -o $(OUTNAME) crc64.c
ifeq ($(STRIP),1)
strip $(OUTNAME)
endif