|
1 # This Source Code Form is subject to the terms of the Mozilla Public |
|
2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 |
|
5 CXX := @CXX@ |
|
6 CXXFLAGS := @CXXFLAGS@ |
|
7 LDFLAGS := @LDFLAGS@ |
|
8 VPATH := @srcdir@ |
|
9 |
|
10 # Helper for end |
|
11 NULL := |
|
12 |
|
13 CPPSRCS := \ |
|
14 clang-plugin.cpp \ |
|
15 $(NULL) |
|
16 |
|
17 TESTSRCS := \ |
|
18 TestCustomHeap.cpp \ |
|
19 TestMustOverride.cpp \ |
|
20 TestNonHeapClass.cpp \ |
|
21 TestStackClass.cpp \ |
|
22 $(NULL) |
|
23 |
|
24 OBJS := $(patsubst %.cpp,%.o,$(CPPSRCS)) |
|
25 TESTS := $(patsubst %.cpp,test-%,$(TESTSRCS)) |
|
26 |
|
27 PLUGIN := libclang-plugin.so |
|
28 |
|
29 all: $(PLUGIN) $(TESTS) |
|
30 |
|
31 $(OBJS): %.o: %.cpp Makefile |
|
32 $(CXX) -o $@ -c $(CXXFLAGS) $< |
|
33 |
|
34 $(PLUGIN): $(OBJS) |
|
35 rm -f $@ |
|
36 $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $(OBJS) -lclangASTMatchers |
|
37 |
|
38 TESTFLAGS := -fsyntax-only -Xclang -verify \ |
|
39 -Xclang -load -Xclang $(CURDIR)/$(PLUGIN) \ |
|
40 -Xclang -add-plugin -Xclang moz-check |
|
41 |
|
42 $(TESTS): test-%: tests/%.cpp $(PLUGIN) |
|
43 $(CXX) $(TESTFLAGS) $< |
|
44 |
|
45 compile libs export tools: all |
|
46 |
|
47 distclean clean: |
|
48 rm -f $(OBJS) $(TESTS) $(PLUGIN) |
|
49 |
|
50 check: |
|
51 |
|
52 libs: binaries |
|
53 |
|
54 binaries: all |
|
55 @touch $@ |
|
56 |
|
57 .PHONY: compile libs export tools distclean clean check |