From eb3f56e210605f781a7c5725a5e2320adee45b36 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 11 Sep 2022 14:12:03 +0200 Subject: [PATCH] Small Makefile improvement. --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7557e10..ffa6537 100644 --- a/Makefile +++ b/Makefile @@ -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