CRC-64/Makefile

50 lines
902 B
Makefile
Raw Normal View History

2022-09-09 21:21:39 +02:00
MACHINE := $(shell $(CC) -dumpmachine || echo unknown)
2022-09-11 14:12:03 +02:00
STATIC ?= 1
STRIP ?= 1
2022-09-09 23:12:23 +02:00
ifneq (,$(firstword $(filter x86_64-%,$(MACHINE))))
2022-09-09 21:21:39 +02:00
MARCH ?= x86-64
MTUNE ?= znver3
2022-09-09 21:21:39 +02:00
else
2022-09-09 23:12:23 +02:00
ifneq (,$(firstword $(filter i686-%,$(MACHINE))))
MARCH ?= i586
MTUNE ?= pentium2
endif
2022-09-09 21:21:39 +02:00
endif
CFLAGS = -Wall -std=gnu99 -Ofast -DNDEBUG
2022-09-09 23:12:23 +02:00
2022-09-11 14:12:03 +02:00
ifneq (,$(XCFLAGS))
CFLAGS += $(XCFLAGS)
endif
2022-09-09 23:12:23 +02:00
ifneq (,$(MARCH))
CFLAGS += -march=$(MARCH)
endif
ifneq (,$(MTUNE))
CFLAGS += -mtune=$(MTUNE)
endif
2022-09-09 21:21:39 +02:00
ifneq (,$(firstword $(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE))))
2022-09-09 23:12:23 +02:00
OUTNAME := crc64.exe
2022-09-09 21:21:39 +02:00
else
2022-09-09 23:12:23 +02:00
OUTNAME := crc64
2022-09-09 21:21:39 +02:00
endif
ifneq (,$(firstword $(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE))))
CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -mconsole -municode
endif
2022-09-11 14:12:03 +02:00
ifeq ($(STATIC),1)
CFLAGS += -static
endif
2022-09-09 21:21:39 +02:00
.PHONY: all
all:
2022-09-09 23:12:23 +02:00
$(CC) $(CFLAGS) -o $(OUTNAME) crc64.c
2022-09-11 14:12:03 +02:00
ifeq ($(STRIP),1)
strip $(OUTNAME)
endif