forked from sas/clang-cache
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (41 loc) · 1.33 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
CXX_SOURCES := src/clang-cache.cpp src/client/client.cpp src/server/server.cpp src/utils/mkdirp.cpp src/utils/daemon.cpp src/utils/socket.cpp
THRIFT_SOURCES := src/proto.thrift
DOC_SOURCES := doc/clang-cache.1.md
CXX ?= g++
CXXFLAGS := -std=c++11 -Wall -Wextra -Werror -I$(dir $(lastword $(MAKEFILE_LIST)))src
LDFLAGS := -lthrift
PREFIX := /usr/local
GEN_SOURCES := $(THRIFT_SOURCES:.thrift=_types.cpp) $(THRIFT_SOURCES:.thrift=_constants.cpp)
OBJECTS := $(CXX_SOURCES:.cpp=.o) $(GEN_SOURCES:.cpp=.o)
DEPENDS := $(OBJECTS:.o=.d)
TARGET := src/clang-cache
DOCTARGETS := $(DOC_SOURCES:.1.md=.1)
VPATH := $(dir $(lastword $(MAKEFILE_LIST)))
default: $(TARGET)
all: $(TARGET) $(DOCTARGETS)
install: all
install -d $(PREFIX)/bin/
install -d $(PREFIX)/share/man/man1/
install -s -t $(PREFIX)/bin/ $(TARGET)
install -t $(PREFIX)/share/man/man1/ $(DOCTARGETS)
clean:
rm -f $(GEN_SOURCES)
rm -f $(OBJECTS)
rm -f $(DEPENDS)
distclean: clean
rm -f $(TARGET)
rm -f $(DOCTARGETS)
$(TARGET): $(OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $^
%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -MMD -o $@ -c $<
%_types.cpp %_types.h %_constants.cpp %_constants.h: %.thrift
@mkdir -p $(dir $@)
thrift --gen cpp -out $(dir $<) $<
%.1: %.1.md
@mkdir -p $(dir $@)
ronn --roff --pipe $< >$@
.PHONY: all install clean distclean
.SECONDARY:
-include $(DEPENDS)