-
Notifications
You must be signed in to change notification settings - Fork 17
/
makefile
83 lines (67 loc) · 2.5 KB
/
makefile
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
all: kmer-db
# *** REFRESH makefile utils
include refresh.mk
$(call INIT_SUBMODULES)
$(call INIT_GLOBALS)
$(call CHECK_OS_ARCH, $(PLATFORM))
# *** Project directories
$(call SET_SRC_OBJ_BIN,src,obj,bin)
3RD_PARTY_DIR := ./libs
SRC_SIMD_DIR := $(SRC_DIR)/simd
OBJ_SIMD_DIR := $(OBJ_DIR)/simd
# *** Project configuration
$(call CHECK_NASM)
$(call PROPOSE_ZLIB_NG, $(3RD_PARTY_DIR)/zlib-ng)
$(call PROPOSE_ISAL, $(3RD_PARTY_DIR)/isa-l)
$(call ADD_MIMALLOC, $(3RD_PARTY_DIR)/mimalloc)
$(call CHOOSE_GZIP_DECOMPRESSION)
$(call ADD_REFRESH_LIB, $(3RD_PARTY_DIR))
$(call SET_STATIC, $(STATIC_LINK))
$(call SET_C_CPP_STANDARDS, c11, c++20)
$(call SET_GIT_COMMIT)
$(call SET_FLAGS, $(TYPE))
$(call SET_COMPILER_VERSION_ALLOWED, GCC, Linux_x86_64, 10, 20)
$(call SET_COMPILER_VERSION_ALLOWED, GCC, Linux_aarch64, 11, 20)
$(call SET_COMPILER_VERSION_ALLOWED, GCC, Darwin_x86_64, 11, 13)
$(call SET_COMPILER_VERSION_ALLOWED, GCC, Darwin_arm64, 11, 13)
ifneq ($(MAKECMDGOALS),clean)
$(call CHECK_COMPILER_VERSION)
endif
# *** Source files and rules
$(eval $(call PREPARE_DEFAULT_COMPILE_RULE,MAIN,))
$(eval $(call PREPARE_DEFAULT_COMPILE_RULE,KMC_API,kmc_api))
# *** SIMD rules
# Main kmer-db files
ifeq ($(ARCH_TYPE),x86_64)
SRC_SIMD := $(SRC_SIMD_DIR)/row_add_avx.cpp $(SRC_SIMD_DIR)/row_add_avx2.cpp
$(OBJ_SIMD_DIR)/row_add_avx.cpp.o: $(SRC_SIMD_DIR)/row_add_avx.cpp
@mkdir -p $(OBJ_SIMD_DIR)
$(CXX) $(CPP_FLAGS_AVX) $(OPTIMIZATION_FLAGS) $(ARCH_FLAGS) $(INCLUDE_DIRS) -MMD -MF $@.d -c $< -o $@
$(OBJ_SIMD_DIR)/row_add_avx2.cpp.o: $(SRC_SIMD_DIR)/row_add_avx2.cpp
@mkdir -p $(OBJ_SIMD_DIR)
$(CXX) $(CPP_FLAGS_AVX2) $(OPTIMIZATION_FLAGS) $(ARCH_FLAGS) $(INCLUDE_DIRS) -MMD -MF $@.d -c $< -o $@
else
SRC_SIMD := $(SRC_SIMD_DIR)/row_add_neon.cpp
$(OBJ_SIMD_DIR)/row_add_neon.cpp.o: $(SRC_SIMD_DIR)/row_add_neon.cpp
@mkdir -p $(OBJ_SIMD_DIR)
$(CXX) $(CPP_FLAGS_NEON) $(OPTIMIZATION_FLAGS) $(ARCH_FLAGS) $(INCLUDE_DIRS) -MMD -MF $@.d -c $< -o $@
endif
OBJ_SIMD := $(patsubst $(SRC_SIMD_DIR)/%.cpp, $(OBJ_SIMD_DIR)/%.cpp.o, $(SRC_SIMD))
# Dependency files (needed only for SIMD)
-include $(OBJ_SIMD:.o=.o.d)
# *** Targets
kmer-db: $(OUT_BIN_DIR)/kmer-db
$(OUT_BIN_DIR)/kmer-db: $(GZ_TARGET) mimalloc_obj \
$(OBJ_MAIN) $(OBJ_KMC_API) $(OBJ_SIMD)
-mkdir -p $(OUT_BIN_DIR)
$(CXX) -o $@ \
$(MIMALLOC_OBJ) \
$(OBJ_MAIN) $(OBJ_KMC_API) $(OBJ_SIMD) \
$(LIBRARY_FILES) $(LINKER_FLAGS) $(LINKER_DIRS)
# *** Cleaning
.PHONY: clean init
clean: clean-zlib-ng clean-isa-l clean-mimalloc_obj
-rm -r $(OBJ_DIR)
-rm -r $(OUT_BIN_DIR)
init:
$(call INIT_SUBMODULES)