-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
49 lines (37 loc) · 1.19 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
# Example commands:
# make (build in release mode)
# make debug (build in debug mode)
# make clean (deletes *.o files, which aren't required to run the aligner)
# make distclean (deletes *.o files and the binary)
# make CXX=g++-5 (build with a particular compiler)
# make CXXFLAGS="-Werror -g3" (build with particular compiler flags)
# CXX and CXXFLAGS can be overridden by the user.
CXX ?= g++
CXXFLAGS ?= -Wall -Wextra -pedantic -mtune=native
# These flags are required for the build to work.
LIB = -lz
FLAGS = -std=c++11
# Different debug/optimisation levels for debug/release builds.
DEBUGFLAGS = -g
RELEASEFLAGS = -O3
TARGET = bin/filtlong
SHELL = /bin/sh
SOURCES = $(shell find src -name "*.cpp")
HEADERS = $(shell find src -name "*.h")
OBJECTS = $(SOURCES:.cpp=.o)
.PHONY: release
release: FLAGS+=$(RELEASEFLAGS)
release: $(TARGET)
.PHONY: debug
debug: FLAGS+=$(DEBUGFLAGS)
debug: $(TARGET)
dir_guard=@mkdir -p $(@D)
$(TARGET): $(OBJECTS)
$(dir_guard)
$(CXX) $(FLAGS) $(CXXFLAGS) -o $(TARGET) $(OBJECTS) $(LIB)
clean:
$(RM) $(OBJECTS)
distclean: clean
$(RM) $(TARGET)
%.o: %.cpp $(HEADERS)
$(CXX) $(FLAGS) $(CXXFLAGS) -c -o $@ $<