-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (36 loc) · 947 Bytes
/
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
NAME = pmserver
CPPFLAGS += -std=c++14
LIBS = -lportmidi
LDFLAGS += $(LIBS)
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
TEST_LIBS = $(LIBS) -lCatch2Main -lCatch2
.PHONY: all test install uninstall tags clean distclean
all: $(NAME)
$(NAME): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^
-include $(C_SRC:%.c=%.d)
-include $(CPP_SRC:%.cpp=%.d)
test: $(NAME)_test
./$(NAME)_test
$(NAME)_test: $(OBJS) $(TEST_OBJS)
$(CXX) $(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 test/*.o
distclean: clean
rm -f src/*.d test/*.d