-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
81 lines (61 loc) · 2.07 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
include config.mak
CXXFLAGS+=-Wall -Wextra -std=c++11 -pedantic -fPIC
# For LLVM installed in a custom location
LDFLAGS+=-rpath $(LLVM_LIBDIR)
DEPDIR := .d
COMPILE.cc = $(CXX) $(CXXFLAGS) -c
all: lib/libclang-vim.so qa/test qa/tool git-hooks
lib_objects = \
lib/libclang-vim/AST_extracter.o \
lib/libclang-vim/clang_vim.o \
lib/libclang-vim/deduction.o \
lib/libclang-vim/helpers.o \
lib/libclang-vim/location.o \
lib/libclang-vim/stringizers.o \
lib/libclang-vim/tokenizer.o \
lib/libclang-vim.so: $(lib_objects)
$(LINK.cpp) $^ $(LDFLAGS) $(LLVM_LDFLAGS) -lclang -shared -o $@
qa_objects = \
qa/ast.o \
qa/deduction.o \
qa/location.o \
qa/test.o \
qa/tokenizer.o \
qa/test: $(qa_objects)
$(LINK.cpp) $^ $(CPPUNIT_LIBS) -ldl -o $@
tool_objects = qa/tool.o
qa/tool: $(tool_objects)
$(LINK.cpp) $^ -ldl -o $@
all_objects = $(lib_objects) $(qa_objects) $(tool_objects)
lib/libclang-vim/%.o : lib/libclang-vim/%.cpp
mkdir -p $(DEPDIR)/lib/libclang-vim
$(COMPILE.cc) -MT $@ -MMD -MP -MF $(DEPDIR)/lib/libclang-vim/$*.d_ $(LLVM_CXXFLAGS) $(OUTPUT_OPTION) $<
mv $(DEPDIR)/lib/libclang-vim/$*.d_ $(DEPDIR)/lib/libclang-vim/$*.d
qa/%.o : qa/%.cpp
mkdir -p $(DEPDIR)/qa
$(COMPILE.cc) -MT $@ -MMD -MP -MF $(DEPDIR)/qa/$*.d_ $(CPPUNIT_CFLAGS) -DSRC_ROOT=\"$(SRC_ROOT)\" $(OUTPUT_OPTION) $<
mv $(DEPDIR)/qa/$*.d_ $(DEPDIR)/qa/$*.d
SRCS = $(patsubst %.o,%.cpp,$(all_objects))
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
-include $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS)))
config.mak: configure.ac config.mak.in qa/data/compile-commands/compile_commands.json.in
./autogen.sh
clean:
rm -f lib/libclang-vim.so qa/test $(all_objects)
check: all
qa/test
tags:
ctags --c++-kinds=+p --fields=+iaS --extra=+q -R --totals=yes *
clang-tidy:
$(HOME)/git/llvm/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py
clang-format:
clang-format -i $(shell git ls-files|egrep '(hpp|cpp)$$')
# Auto-enable git hooks.
ifneq ($(wildcard .git/hooks/*),)
git-hooks: .git/hooks/pre-commit
.git/hooks/pre-commit: git/hooks/pre-commit
cd .git/hooks && ln -s ../../git/hooks/pre-commit
else
git-hooks:
endif