michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: CXX := @CXX@ michael@0: CXXFLAGS := @CXXFLAGS@ michael@0: LDFLAGS := @LDFLAGS@ michael@0: VPATH := @srcdir@ michael@0: michael@0: # Helper for end michael@0: NULL := michael@0: michael@0: CPPSRCS := \ michael@0: clang-plugin.cpp \ michael@0: $(NULL) michael@0: michael@0: TESTSRCS := \ michael@0: TestCustomHeap.cpp \ michael@0: TestMustOverride.cpp \ michael@0: TestNonHeapClass.cpp \ michael@0: TestStackClass.cpp \ michael@0: $(NULL) michael@0: michael@0: OBJS := $(patsubst %.cpp,%.o,$(CPPSRCS)) michael@0: TESTS := $(patsubst %.cpp,test-%,$(TESTSRCS)) michael@0: michael@0: PLUGIN := libclang-plugin.so michael@0: michael@0: all: $(PLUGIN) $(TESTS) michael@0: michael@0: $(OBJS): %.o: %.cpp Makefile michael@0: $(CXX) -o $@ -c $(CXXFLAGS) $< michael@0: michael@0: $(PLUGIN): $(OBJS) michael@0: rm -f $@ michael@0: $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $(OBJS) -lclangASTMatchers michael@0: michael@0: TESTFLAGS := -fsyntax-only -Xclang -verify \ michael@0: -Xclang -load -Xclang $(CURDIR)/$(PLUGIN) \ michael@0: -Xclang -add-plugin -Xclang moz-check michael@0: michael@0: $(TESTS): test-%: tests/%.cpp $(PLUGIN) michael@0: $(CXX) $(TESTFLAGS) $< michael@0: michael@0: compile libs export tools: all michael@0: michael@0: distclean clean: michael@0: rm -f $(OBJS) $(TESTS) $(PLUGIN) michael@0: michael@0: check: michael@0: michael@0: libs: binaries michael@0: michael@0: binaries: all michael@0: @touch $@ michael@0: michael@0: .PHONY: compile libs export tools distclean clean check