-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (43 loc) · 1.4 KB
/
Copy pathMakefile
File metadata and controls
61 lines (43 loc) · 1.4 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
NAME = kronut
# DEBUG = -DDEBUG -DDEBUG_STDERR
# Use pkg-config for rtmidi if available, otherwise use system defaults
RTMIDI_CFLAGS := $(shell pkg-config --cflags rtmidi 2>/dev/null || echo "-I/usr/include")
RTMIDI_LIBS := $(shell pkg-config --libs rtmidi 2>/dev/null || echo "-lrtmidi")
CPPFLAGS += -std=c++14 -g $(DEBUG) $(RTMIDI_CFLAGS)
LIBS = $(RTMIDI_LIBS)
TESTLIBS = -lCatch2 -lCatch2Main
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
SRC = $(wildcard src/*.cpp)
OBJS = $(SRC:%.cpp=%.o)
TEST_SRC = $(wildcard test/*.cpp)
TEST_OBJS = $(TEST_SRC:%.cpp=%.o)
TEST_OBJ_FILTERS = src/$(NAME).o
CATCH_CATEGORY ?= ""
%.d: %.cpp
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) -MQ $(<:%.cpp=%.o) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
.PHONY: all test install uninstall tags clean distclean
all: $(NAME)
$(NAME): $(OBJS)
$(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
-include $(SRC:%.cpp=%.d)
-include $(TEST_SRC:%.cpp=%.d)
test: $(NAME)_test
./$(NAME)_test --colour-mode none $(CATCH_CATEGORY)
$(NAME)_test: $(OBJS) $(TEST_OBJS)
$(CXX) -o $@ $(filter-out $(TEST_OBJ_FILTERS),$^) $(LDFLAGS) $(LIBS) $(TESTLIBS)
install: $(NAME)
install -s $(NAME) $(bindir)
uninstall:
rm -f $(bindir)/$(NAME)
tags: TAGS
TAGS: $(SRC)
etags $(SRC)
clean:
rm -f $(NAME) $(NAME)_test src/*.o test/*.o
distclean: clean
rm -f src/*.d src/*.d.* test/*.d test/*.d.*