CRC-64/Makefile

51 lines
883 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 -pedantic -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 += -mconsole -municode
2022-09-09 21:21:39 +02:00
endif
2022-09-11 14:12:03 +02:00
ifeq ($(STATIC),1)
CFLAGS += -static
endif
2022-09-09 21:21:39 +02:00
2022-09-15 21:58:05 +02:00
ifeq ($(STRIP),1)
CFLAGS += -s
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