Some Linux build fixes.

This commit is contained in:
LoRd_MuldeR 2022-09-09 23:12:23 +02:00
parent d268ea501c
commit ed0d714686
2 changed files with 18 additions and 10 deletions

View File

@ -1,19 +1,28 @@
MACHINE := $(shell $(CC) -dumpmachine || echo unknown) MACHINE := $(shell $(CC) -dumpmachine || echo unknown)
ifneq (,$(firstword $(filter x86_64-%,$(shell $(CC) -dumpmachine)))) ifneq (,$(firstword $(filter x86_64-%,$(MACHINE))))
MARCH ?= x86-64 MARCH ?= x86-64
MTUNE ?= nocona MTUNE ?= nocona
else else
ifneq (,$(firstword $(filter i686-%,$(MACHINE))))
MARCH ?= i586 MARCH ?= i586
MTUNE ?= pentium2 MTUNE ?= pentium2
endif
endif endif
CFLAGS = -Wall -std=gnu99 -O3 -march=$(MARCH) -mtune=$(MTUNE) -DNDEBUG CFLAGS = -Wall -std=gnu99 -O3 -DNDEBUG
ifneq (,$(MARCH))
CFLAGS += -march=$(MARCH)
endif
ifneq (,$(MTUNE))
CFLAGS += -mtune=$(MTUNE)
endif
ifneq (,$(firstword $(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)))) ifneq (,$(firstword $(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE))))
SUFFIX := .exe OUTNAME := crc64.exe
else else
SUFFIX := OUTNAME := crc64
endif endif
ifneq (,$(firstword $(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE)))) ifneq (,$(firstword $(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE))))
@ -25,4 +34,4 @@ CFLAGS += -s -static
.PHONY: all .PHONY: all
all: all:
$(CC) $(CFLAGS) -o crc64$(SUFFIX) crc64.c $(CC) $(CFLAGS) -o $(OUTNAME) crc64.c

View File

@ -18,8 +18,6 @@
#include <Windows.h> #include <Windows.h>
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#else
#include <unistd.h>
#endif #endif
static const int VERSION_MAJOR = 1; static const int VERSION_MAJOR = 1;
@ -68,7 +66,8 @@ int _dowildcard = -1;
#define FPUTS fputs #define FPUTS fputs
#define FPRINTF fprintf #define FPRINTF fprintf
#define FOPEN fopen #define FOPEN fopen
#define T(X) (X) #define __T(X) X
#define T(X) __T(X)
#endif #endif