-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile_no_mimalloc
67 lines (54 loc) · 2.05 KB
/
makefile_no_mimalloc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
all: rapid-cluster
####################
ifdef MSVC # Avoid the MingW/Cygwin sections
uname_S := Windows
else # If uname not available => 'not'
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
endif
ifeq ($(uname_S),Linux)
# check if CPU supports AVX2
HAVE_AVX2=$(filter-out 0,$(shell grep avx2 /proc/cpuinfo | wc -l))
OMP_FLAGS = -fopenmp
ABI_FLAGS = -fabi-version=6
endif
ifeq ($(uname_S),Darwin)
# check if CPU supports SSE4.2
HAVE_AVX2=$(filter-out 0,$(shell sysctl -n machdep.cpu.features machdep.cpu.leaf7_features| grep AVX2 - | wc -l))
OMP_FLAGS = -Xpreprocessor -fopenmp
ABI_FLAGS =
endif
## ###################
ROOT_DIR = .
MAIN_DIR = src
LIBS_DIR = src/kmc_api
MIMALLOC_INLUCDE_DIR = libs/mimalloc/include
ifeq ($(STATIC_LINK), true)
LDFLAGS +=
CFLAGS += -Wall -O3 -m64 -std=c++17 $(OMP_FLAGS) -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive
CFLAGS_AVX2 += $(CFLAGS) -mavx2 -I $(LIBS_DIR)
CFLAGS += -mavx -I $(LIBS_DIR) -I $(MIMALLOC_INLUCDE_DIR)
CLINK = -lm -static -O3 -std=c++17 -mavx $(OMP_FLAGS) $(ABI_FLAGS) -Wl,--whole-archive -lpthread -Wl,--no-whole-archive
else
LDFLAGS +=
CFLAGS += -Wall -O3 -m64 -std=c++17 $(OMP_FLAGS) -pthread
CFLAGS_AVX2 += $(CFLAGS) -mavx2 -I $(LIBS_DIR)
CFLAGS += -mavx -I $(LIBS_DIR) -I $(MIMALLOC_INLUCDE_DIR)
CLINK = -lm -O3 -std=c++17 -pthread $(OMP_FLAGS) -mavx $(ABI_FLAGS)
endif
MIMALLOC_OBJ=libs/mimalloc/mimalloc.o
$(MIMALLOC_OBJ):
$(CC) -DMI_MALLOC_OVERRIDE -O3 -DNDEBUG -fPIC -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden -Wstrict-prototypes -ftls-model=initial-exec -fno-builtin-malloc -std=gnu11 -c -I libs/mimalloc/include libs/mimalloc/src/static.c -o $(MIMALLOC_OBJ)
OBJS := \
$(MAIN_DIR)/console.o \
$(MAIN_DIR)/conversion.o \
$(MAIN_DIR)/distances.o \
$(MAIN_DIR)/main.o \
%.o: %.cpp
$(CXX) $(CFLAGS) -c $< -o $@
rapid-cluster: $(OBJS)
$(CXX) $(CLINK) $(LDFLAGS) -o $(ROOT_DIR)/$@ $(OBJS)
clean:
-rm $(MAIN_DIR)/*.o
-rm $(LIBS_DIR)/*.o
-rm $(MIMALLOC_OBJ)
-rm rapid-cluster