-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (41 loc) · 1.28 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
50
51
52
53
54
55
56
57
58
59
60
NAME = trinket
# DEBUG = -DDEBUG -DDEBUG_STDERR
WXFLAGS := $(shell wx-config --cxxflags)
WXLIBS := $(shell wx-config --libs)
CPP = $(shell wx-config --cxx)
CPPFLAGS += -std=c++14 -MD -MP -g $(DEBUG) $(WXFLAGS)
LD = $(shell wx-config --ld)
LIBS = -lportmidi
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
SRC = $(wildcard src/*.cpp) $(wildcard src/pipes/*.cpp) $(wildcard src/wx/*.cpp)
OBJS = $(SRC:%.cpp=%.o)
TEST_SRC = $(wildcard test/*.cpp)
TEST_OBJS = $(TEST_SRC:%.cpp=%.o)
TEST_OBJ_FILTERS = src/main.o
TEST_LIBS = $(LIBS) -lCatch2Main -lCatch2
CATCH_CATEGORY ?= ""
.PHONY: all test install uninstall tags clean distclean
all: $(NAME)
$(NAME): $(OBJS)
$(CXX) $(LDFLAGS) $(LIBS) $(WXLIBS) -o $@ $^
-include $(SRC:%.cpp=%.d)
-include $(TEST_SRC:%.cpp=%.d)
test: $(NAME)_test
./$(NAME)_test --colour-mode=none $(CATCH_CATEGORY)
$(NAME)_test: $(OBJS) $(TEST_OBJS)
$(LD) $(LDFLAGS) $(TEST_LIBS) -o $@ $(filter-out $(TEST_OBJ_FILTERS),$^)
install: $(bindir)/$(NAME)
$(bindir)/$(NAME): $(NAME)
cp ./$(NAME) $(bindir)
chmod 755 $(bindir)/$(NAME)
uninstall:
rm -f $(bindir)/$(name)
tags: TAGS
TAGS: $(SRC)
etags $(SRC)
clean:
rm -f $(NAME) $(NAME)_test src/*.o src/pipes/*.o src/wx/*.o test/*.o
distclean: clean
rm -f src/*.d src/pipes/*.d src/wx/*.d test/*.d