Small Makefile improvement.

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

View File

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