1#
2# Copyright (C) 2011 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17include art/build/Android.common_build.mk
18
19ART_CPPLINT := art/tools/cpplint.py
20ART_CPPLINT_FILTER := --filter=-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references,-runtime/sizeof,-runtime/threadsafe_fn,-runtime/printf
21ART_CPPLINT_SRC := $(shell find art -name "*.h" -o -name "*$(ART_CPP_EXTENSION)" | grep -v art/compiler/llvm/generated/ | grep -v art/runtime/elf\.h)
22
23# "mm cpplint-art" to verify we aren't regressing
24.PHONY: cpplint-art
25cpplint-art:
26	$(ART_CPPLINT) $(ART_CPPLINT_FILTER) $(ART_CPPLINT_SRC)
27
28# "mm cpplint-art-all" to see all warnings
29.PHONY: cpplint-art-all
30cpplint-art-all:
31	$(ART_CPPLINT) $(ART_CPPLINT_SRC)
32
33OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint
34
35ART_CPPLINT_TARGETS :=
36
37define declare-art-cpplint-target
38art_cpplint_file := $(1)
39art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file))
40
41$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) art/build/Android.cpplint.mk
42	$(hide) $(ART_CPPLINT) $(ART_CPPLINT_FILTER) $$<
43	@mkdir -p $$(dir $$@)
44	$(hide) touch $$@
45
46ART_CPPLINT_TARGETS += $$(art_cpplint_touch)
47endef
48
49$(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file))))
50#$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC))))
51
52include $(CLEAR_VARS)
53LOCAL_MODULE := cpplint-art-phony
54LOCAL_MODULE_TAGS := optional
55LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS)
56include $(BUILD_PHONY_PACKAGE)
57