blob: ab70e97ac5307692f81f53622dc7bfa58a51a15e [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
Artem Kotsiubadc8fa4d2021-06-22 16:26:30 +010019# We need to be in art directory to properly initialize ART_CPPLINT_SRC variable.
20LOCAL_PATH := $(art_path)
21
Igor Murashkin2a2d3112017-11-14 15:03:25 -080022# Use upstream cpplint (toolpath from .repo/manifests/GLOBAL-PREUPLOAD.cfg).
Orion Hodsona1d4c562021-11-11 15:01:25 +000023ART_CPPLINT := tools/repohooks/tools/cpplint.py
Alex Light49948e92016-08-11 15:35:28 -070024
Igor Murashkin2a2d3112017-11-14 15:03:25 -080025# This file previously configured many cpplint settings.
26# Everything that could be moved to CPPLINT.cfg has moved there.
27# Please add new settings to CPPLINT.cfg over adding new flags in this file.
28
29ART_CPPLINT_FLAGS :=
30# No output when there are no errors.
31ART_CPPLINT_QUIET := --quiet
32
33# 1) Get list of all .h & .cc files in the art directory.
Alex Light80c0d792016-01-12 11:10:23 -080034# 2) Prepends 'art/' to each of them to make the full name.
Igor Murashkin2a2d3112017-11-14 15:03:25 -080035ART_CPPLINT_SRC := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION)))
36
37# 1) Get list of all CPPLINT.cfg files in the art directory.
38# 2) Prepends 'art/' to each of them to make the full name.
39ART_CPPLINT_CFG := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,CPPLINT.cfg))
Brian Carlstrom05eecea2013-07-18 21:59:52 -070040
41# "mm cpplint-art" to verify we aren't regressing
Igor Murashkin2a2d3112017-11-14 15:03:25 -080042# - files not touched since the last build are skipped (quite fast).
Brian Carlstrom05eecea2013-07-18 21:59:52 -070043.PHONY: cpplint-art
Igor Murashkin2a2d3112017-11-14 15:03:25 -080044cpplint-art: cpplint-art-phony
Brian Carlstrom05eecea2013-07-18 21:59:52 -070045
Igor Murashkin2a2d3112017-11-14 15:03:25 -080046# "mm cpplint-art-all" to manually execute cpplint.py on all files (very slow).
Brian Carlstrom05eecea2013-07-18 21:59:52 -070047.PHONY: cpplint-art-all
48cpplint-art-all:
Colin Cross6744a5c2017-07-14 12:45:27 -070049 $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070050
51OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint
52
Igor Murashkin2a2d3112017-11-14 15:03:25 -080053# Build up the list of all targets for linting the ART source files.
Brian Carlstrom05eecea2013-07-18 21:59:52 -070054ART_CPPLINT_TARGETS :=
55
56define declare-art-cpplint-target
57art_cpplint_file := $(1)
58art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file))
59
Igor Murashkin2a2d3112017-11-14 15:03:25 -080060$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) $(ART_CPPLINT_CFG) art/build/Android.cpplint.mk
61 $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $$<
Alex Light91de25f2015-10-28 17:00:06 -070062 $(hide) mkdir -p $$(dir $$@)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070063 $(hide) touch $$@
64
65ART_CPPLINT_TARGETS += $$(art_cpplint_touch)
66endef
67
68$(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file))))
69#$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC))))
70
71include $(CLEAR_VARS)
72LOCAL_MODULE := cpplint-art-phony
Bob Badour9150de62021-02-26 03:22:24 -080073LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
74LOCAL_LICENSE_CONDITIONS := notice
75LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
Brian Carlstrom05eecea2013-07-18 21:59:52 -070076LOCAL_MODULE_TAGS := optional
77LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS)
78include $(BUILD_PHONY_PACKAGE)