-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
28 lines (20 loc) · 574 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
all: main clean-deps
CXX = clang++
override CXXFLAGS += -g -Wno-everything
SRCS = $(shell find . -name '.ccls-cache' -type d -prune -o -type f -name '*.cpp' -print | sed -e 's/ /\\ /g')
OBJS = $(SRCS:.cpp=.o)
DEPS = $(SRCS:.cpp=.d)
%.d: %.cpp
@set -e; rm -f "$@"; \
$(CXX) -MM $(CXXFLAGS) "$<" > "$@.$$$$"; \
sed 's,\([^:]*\)\.o[ :]*,\1.o \1.d : ,g' < "$@.$$$$" > "$@"; \
rm -f "$@.$$$$"
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c "$<" -o "$@"
include $(DEPS)
main: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o "$@"
clean:
rm -f $(OBJS) $(DEPS) main
clean-deps:
rm -f $(DEPS)