-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (36 loc) · 1.23 KB
/
Makefile
File metadata and controls
45 lines (36 loc) · 1.23 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
# Directories
INCL_DIR := $(CURDIR)/include
SRC_DIR := $(CURDIR)/src
BUILD_DIR := $(CURDIR)/build
LIB_DIR := $(CURDIR)/lib
# Conda environment directories
CONDA_PREFIX := $(shell echo $$CONDA_PREFIX)
CONDA_INCL_DIR := $(CONDA_PREFIX)/include
CONDA_LIB_DIR := $(CONDA_PREFIX)/lib
# Compiler and Flags
CXX := g++
CXXFLAGS := -std=c++17 -g -I$(INCL_DIR) -I$(CONDA_INCL_DIR) -Wall -Wextra -pedantic
# Linker Flags
# Ensure that the library paths are set correctly for linking
LDFLAGS := -L$(LIB_DIR) -L$(CONDA_LIB_DIR) -Wl,-rpath=$(CONDA_LIB_DIR) # Add rpath for shared libraries
LDLIBS := -lhts # Link with libhts.a or libhts.so
# Sources and Output
SOURCES := $(filter-out $(SRC_DIR)/swig_wrapper.cpp, $(wildcard $(SRC_DIR)/*.cpp)) # Filter out the SWIG wrapper from the sources
OBJECTS := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SOURCES))
TARGET := $(BUILD_DIR)/contextsv
# Default target
all: $(TARGET)
# Debug target
debug: CXXFLAGS += -DDEBUG
debug: all
# Link the executable
$(TARGET): $(OBJECTS)
@mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
# Compile source files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean the build directory
clean:
rm -rf $(BUILD_DIR)