-
Notifications
You must be signed in to change notification settings - Fork 334
/
Makefile
45 lines (33 loc) · 1.04 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
DIR_INC := ./inc
DIR_SRC := ./src
DIR_OBJ := ./obj
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
INCLUDE_DIRS ?=
LIBRARY_DIRS ?=
SRC := $(wildcard ${DIR_SRC}/*.cpp)
OBJ := $(patsubst %.cpp,${DIR_OBJ}/%.o,$(notdir ${SRC}))
TARGET := fastp
BIN_TARGET := ${TARGET}
CXX ?= g++
CXXFLAGS := -std=c++11 -pthread -g -O3 -MD -MP -I${DIR_INC} $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) ${CXXFLAGS}
LIBS := -lisal -ldeflate -lpthread
STATIC_FLAGS := -static -Wl,--no-as-needed -pthread
LD_FLAGS := $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(LIBS) $(LD_FLAGS)
STATIC_LD_FLAGS := $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(STATIC_FLAGS) $(LIBS) $(STATIC_LD_FLAGS)
${BIN_TARGET}:${OBJ}
$(CXX) $(OBJ) -o $@ $(LD_FLAGS)
static:${OBJ}
$(CXX) $(OBJ) -o ${BIN_TARGET} $(STATIC_LD_FLAGS)
${DIR_OBJ}/%.o:${DIR_SRC}/%.cpp
@mkdir -p $(@D)
$(CXX) -c $< -o $@ $(CXXFLAGS)
.PHONY:clean
.PHONY:static
clean:
@rm -rf $(DIR_OBJ)
@rm -f $(TARGET)
install:
install $(TARGET) $(BINDIR)/$(TARGET)
@echo "Installed."
-include $(OBJ:.o=.d)