-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (37 loc) · 1.11 KB
/
Makefile
File metadata and controls
51 lines (37 loc) · 1.11 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
VERSION ?= Debug
CFLAGS_Debug = -g
CFLAGS_Release = -O2 -DNDEBUG
VERBOSE ?= 0
VERBOSE_0=@
V=$(VERBOSE_$(VERBOSE))
CXX = g++
CFLAGS = -std=c++11 $(CFLAGS_${VERSION}) -DGCAT_CONFIG=\"$(CURDIR)/gcat.cfg\"
LDFLAGS = -lgsl -lgslcblas -lcairo
WARNINGS = -Wall -Wno-unused-variable
SOURCES = $(shell find src/ -name *.cpp)
HEADERS = $(shell find src/ -name *.hpp)
OBJECTS = $(SOURCES:src/%.cpp=obj/%.o)
DEPFILES = $(SOURCES:src/%.cpp=obj/%.deps)
EXECUTABLE = graphcat
CFORMAT = $(shell which clang-format >/dev/null 2>&1 \
&& echo clang-format || echo clang-format-3.8)
.PHONY: all clean format todo
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(DEPFILES)
@echo Linking
$V$(CXX) $(OBJECTS) -o $(EXECUTABLE) $(LDFLAGS)
obj/%.o: src/%.cpp
@echo Compiling $<
@mkdir -p $(@D)
$V$(CXX) $(CFLAGS) -c $(WARNINGS) -o $@ $<
obj/%.deps: src/%.cpp
@mkdir -p $(@D)
@$(CXX) $(CFLAGS) -MM -MT $(@:%.deps=%.o) $< > $@
-include $(DEPFILES)
clean:
@rm -rf $(EXECUTABLE) obj
format:
@$(CFORMAT) -i $(SOURCES) $(HEADERS)
todo: $(SOURCES:%=todo/%) $(HEADERS:%=todo/%)
todo/%: %
@grep -nH -e TODO $< | sed 's/\s*\/\/\/*\s*TODO\s*/ /'