2022-11-30 16:41:14 +01:00
|
|
|
DUMPMACHINE := $(strip $(shell $(CC) -dumpmachine))
|
2022-11-30 16:15:12 +01:00
|
|
|
ifeq ($(DUMPMACHINE),)
|
2022-11-30 16:41:14 +01:00
|
|
|
$(error C compiler could not be detected!)
|
2022-11-30 16:15:12 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(DEBUG),)
|
|
|
|
XCFLAGS = -Og -g
|
|
|
|
else
|
|
|
|
ifneq ($(ASAN),)
|
|
|
|
XCFLAGS = -O1 -g -fsanitize=address -fno-omit-frame-pointer
|
|
|
|
XLDFLAGS += -static-libasan
|
|
|
|
else
|
|
|
|
XCFLAGS = -Ofast -DNDEBUG
|
2022-12-05 00:19:42 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2022-11-30 16:15:12 +01:00
|
|
|
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
|
|
|
|
XCFLAGS += -march=x86-64 -mtune=nocona
|
|
|
|
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
|
|
|
XCFLAGS += -march=pentiumpro -mtune=intel
|
|
|
|
endif
|
|
|
|
|
2022-12-03 14:54:55 +01:00
|
|
|
ifeq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
|
2022-12-03 02:21:53 +01:00
|
|
|
DLL_LDFLAGS = -shared
|
2022-12-01 16:26:47 +01:00
|
|
|
DLL_SUFFIX := .so
|
|
|
|
else
|
|
|
|
DLL_LDFLAGS = -shared -Wl,--out-implib,$@.a
|
2022-11-30 16:15:12 +01:00
|
|
|
EXE_SUFFIX := .exe
|
2022-12-01 16:26:47 +01:00
|
|
|
DLL_SUFFIX := .dll
|
2022-11-30 16:15:12 +01:00
|
|
|
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
|
|
|
XLDFLAGS += -Wl,--large-address-aware
|
|
|
|
endif
|
|
|
|
endif
|
2022-12-05 00:19:42 +01:00
|
|
|
|
|
|
|
ifneq ($(STATIC),)
|
|
|
|
XLDFLAGS += -static
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(FLTO),)
|
|
|
|
XCFLAGS += -flto
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(STRIP),)
|
|
|
|
XLDFLAGS += -Wl,--strip-all
|
|
|
|
DLL_LDFLAGS += -Wl,--strip-all
|
|
|
|
endif
|
2022-12-05 15:03:31 +01:00
|
|
|
|
|
|
|
ifneq ($(firstword $(filter MINGW32_NT-% MINGW64_NT-% CYGWIN_NT-%,$(shell uname))),)
|
|
|
|
ENV_LDPATH := PATH
|
|
|
|
else
|
|
|
|
ENV_LDPATH := LD_LIBRARY_PATH
|
|
|
|
endif
|