Updated README file.
[HashSet.git] / config.mk
blob4f03a5dbec267e3e093e83eda0990c60e21b0942
1 UNAME := $(strip $(shell uname))
2 ifeq ($(UNAME),)
3 $(error Operating system could not be detected!)
4 endif
6 DUMPMACHINE := $(strip $(shell $(CC) -dumpmachine))
7 ifeq ($(DUMPMACHINE),)
8 $(error C compiler could not be detected!)
9 endif
11 ifneq ($(DEBUG),)
12 XCFLAGS = -Og -g
13 else
14 ifneq ($(ASAN),)
15 XCFLAGS = -O1 -g -fsanitize=address -fno-omit-frame-pointer
16 XLDFLAGS += -static-libasan
17 else
18 XCFLAGS = -Ofast -DNDEBUG
19 endif
20 endif
22 ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
23 XCFLAGS += -march=x86-64 -mtune=nocona
24 else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
25 XCFLAGS += -march=pentiumpro -mtune=intel
26 endif
28 ifneq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
29 DLL_LDFLAGS = -shared -Wl,--out-implib,$@.a
30 EXE_SUFFIX := .exe
31 DLL_SUFFIX := .dll
32 ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
33 XLDFLAGS += -Wl,--large-address-aware
34 endif
35 else
36 ifneq ($(findstring -apple-darwin,$(DUMPMACHINE)),)
37 DLL_LDFLAGS = -dynamiclib
38 DLL_SUFFIX := .dylib
39 else
40 DLL_LDFLAGS = -shared
41 DLL_SUFFIX := .so
42 endif
43 endif
45 ifneq ($(STATIC),)
46 XLDFLAGS += -static
47 endif
49 ifneq ($(FLTO),)
50 XCFLAGS += -flto
51 endif
53 ifneq ($(STRIP),)
54 XLDFLAGS += -Wl,--strip-all
55 DLL_LDFLAGS += -Wl,--strip-all
56 endif
58 ifneq ($(firstword $(filter MINGW32_NT-% MINGW64_NT-% CYGWIN_NT-%,$(UNAME))),)
59 ENV_LDPATH := PATH
60 else
61 ifneq ($(firstword $(UNAME)),Darwin)
62 ENV_LDPATH := LD_LIBRARY_PATH
63 else
64 ENV_LDPATH := DYLD_LIBRARY_PATH
65 endif
66 endif