blob: 66ac897f76e941964971f8127c8fa7ccf8ff9e31 [file] [log] [blame]
Brian Carlstrom05eecea2013-07-18 21:59:52 -07001#
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
Ian Rogersafd9acc2014-06-17 08:21:54 -070017include art/build/Android.common_build.mk
18
Alex Light80c0d792016-01-12 11:10:23 -080019ART_CPPLINT := $(LOCAL_PATH)/tools/cpplint.py
Brian Carlstrom7934ac22013-07-26 10:54:15 -070020ART_CPPLINT_FILTER := --filter=-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references,-runtime/sizeof,-runtime/threadsafe_fn,-runtime/printf
Colin Cross6744a5c2017-07-14 12:45:27 -070021ART_CPPLINT_FLAGS := --root=$(TOP)
22ART_CPPLINT_QUIET := --quiet
Alex Light49948e92016-08-11 15:35:28 -070023ART_CPPLINT_INGORED := \
24 runtime/elf.h \
Andreas Gampe5e03a302017-03-13 13:10:00 -070025 runtime/openjdkjvmti/include/jvmti.h
Alex Light49948e92016-08-11 15:35:28 -070026
Alex Light80c0d792016-01-12 11:10:23 -080027# This:
28# 1) Gets a list of all .h & .cc files in the art directory.
29# 2) Prepends 'art/' to each of them to make the full name.
30# 3) removes art/runtime/elf.h from the list.
Alex Light49948e92016-08-11 15:35:28 -070031ART_CPPLINT_SRC := $(filter-out $(patsubst %,$(LOCAL_PATH)/%,$(ART_CPPLINT_INGORED)), $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION))))
Brian Carlstrom05eecea2013-07-18 21:59:52 -070032
33# "mm cpplint-art" to verify we aren't regressing
34.PHONY: cpplint-art
35cpplint-art:
Colin Cross6744a5c2017-07-14 12:45:27 -070036 $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $(ART_CPPLINT_SRC)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070037
38# "mm cpplint-art-all" to see all warnings
39.PHONY: cpplint-art-all
40cpplint-art-all:
Colin Cross6744a5c2017-07-14 12:45:27 -070041 $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070042
43OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint
44
45ART_CPPLINT_TARGETS :=
46
47define declare-art-cpplint-target
48art_cpplint_file := $(1)
49art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file))
50
51$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) art/build/Android.cpplint.mk
Colin Cross6744a5c2017-07-14 12:45:27 -070052 $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $$<
Alex Light91de25f2015-10-28 17:00:06 -070053 $(hide) mkdir -p $$(dir $$@)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070054 $(hide) touch $$@
55
56ART_CPPLINT_TARGETS += $$(art_cpplint_touch)
57endef
58
59$(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file))))
60#$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC))))
61
62include $(CLEAR_VARS)
63LOCAL_MODULE := cpplint-art-phony
64LOCAL_MODULE_TAGS := optional
65LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS)
66include $(BUILD_PHONY_PACKAGE)