-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (83 loc) · 2.57 KB
/
Copy pathMakefile
File metadata and controls
105 lines (83 loc) · 2.57 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# ========================================
# Project Configuration
# ========================================
TARGET := corallel
SRCS := $(wildcard *.c)
OBJS := $(SRCS:.c=.o)
CURRENT_DIR := $(shell pwd)
# ========================================
# Compiler and Flags
# ========================================
CC := gcc
CFLAGS := -O3 -Wall -Wextra -Wpedantic -D_GNU_SOURCE
LDFLAGS := -lm -pthread -lz
# ========================================
# NUMA
# ========================================
NUMA_AVAILABLE := 0
NUMA_INC :=
NUMA_LIB :=
ifneq ($(shell pkg-config --exists libnuma && echo yes),)
NUMA_AVAILABLE := 1
NUMA_INC := $(shell pkg-config --cflags libnuma)
NUMA_LIB := $(shell pkg-config --libs libnuma)
else
ifneq ($(shell printf '\#include <numa.h>\n' | $(CC) -E - >/dev/null 2>&1 && echo yes),)
NUMA_AVAILABLE := 1
NUMA_LIB := -lnuma
endif
endif
# Add macro and libs accordingly
CFLAGS += -DNUMA_AVAILABLE=$(NUMA_AVAILABLE) $(NUMA_INC)
LDFLAGS += $(NUMA_LIB)
# ========================================
# External Libraries
# ========================================
# lcptools
LCPTOOLS_INC := -I$(CURRENT_DIR)/lcptools/include
LCPTOOLS_LIB := -L$(CURRENT_DIR)/lcptools/lib -llcptools -Wl,-rpath,$(CURRENT_DIR)/lcptools/lib
# htslib
HTSLIB_INC := -I$(CURRENT_DIR)/htslib/include
HTSLIB_LIB := -L$(CURRENT_DIR)/htslib/lib -lhts -Wl,-rpath,$(CURRENT_DIR)/htslib/lib
# ========================================
# Combined Flags
# ========================================
INCLUDES := $(LCPTOOLS_INC) $(HTSLIB_INC)
CXXLIBS := $(LCPTOOLS_LIB) $(HTSLIB_LIB)
# ========================================
# Build Rules
# ========================================
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(CXXLIBS) $(LDFLAGS)
rm -f $(OBJS)
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
# ========================================
# Utility Targets
# ========================================
clean:
@echo "Cleaning"
rm -f $(OBJS)
rm -f $(TARGET)
install: clean install-htslib install-lcptools $(TARGET)
install-htslib:
@echo "Installing htslib"
cd htslib && \
autoreconf -i && \
./configure && \
make && \
make prefix=$(CURRENT_DIR)/htslib install
reinstall-htslib:
@echo "Re-installing htslib"
git submodule deinit -f -- htslib
rm -rf htslib
git submodule update --init --recursive
install-lcptools:
@echo "Installing lcptool"
cd lcptools && \
make install PREFIX=$(CURRENT_DIR)/lcptools
recompile-lcptools:
cd lcptools && \
make uninstall PREFIX=$(CURRENT_DIR)/lcptools && \
make install PREFIX=$(CURRENT_DIR)/lcptools