blob: 964a4c896f6591d23f0484c74313635d606496e5 [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
Igor Murashkin2a2d3112017-11-14 15:03:25 -080019# Use upstream cpplint (toolpath from .repo/manifests/GLOBAL-PREUPLOAD.cfg).
20ART_CPPLINT := external/google-styleguide/cpplint/cpplint.py
Alex Light49948e92016-08-11 15:35:28 -070021
Igor Murashkin2a2d3112017-11-14 15:03:25 -080022# This file previously configured many cpplint settings.
23# Everything that could be moved to CPPLINT.cfg has moved there.
24# Please add new settings to CPPLINT.cfg over adding new flags in this file.
25
26ART_CPPLINT_FLAGS :=
27# No output when there are no errors.
28ART_CPPLINT_QUIET := --quiet
29
30# 1) Get list of all .h & .cc files in the art directory.
Alex Light80c0d792016-01-12 11:10:23 -080031# 2) Prepends 'art/' to each of them to make the full name.
Igor Murashkin2a2d3112017-11-14 15:03:25 -080032ART_CPPLINT_SRC := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION)))
33
34# 1) Get list of all CPPLINT.cfg files in the art directory.
35# 2) Prepends 'art/' to each of them to make the full name.
36ART_CPPLINT_CFG := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,CPPLINT.cfg))
Brian Carlstrom05eecea2013-07-18 21:59:52 -070037
38# "mm cpplint-art" to verify we aren't regressing
Igor Murashkin2a2d3112017-11-14 15:03:25 -080039# - files not touched since the last build are skipped (quite fast).
Brian Carlstrom05eecea2013-07-18 21:59:52 -070040.PHONY: cpplint-art
Igor Murashkin2a2d3112017-11-14 15:03:25 -080041cpplint-art: cpplint-art-phony
Brian Carlstrom05eecea2013-07-18 21:59:52 -070042
Igor Murashkin2a2d3112017-11-14 15:03:25 -080043# "mm cpplint-art-all" to manually execute cpplint.py on all files (very slow).
Brian Carlstrom05eecea2013-07-18 21:59:52 -070044.PHONY: cpplint-art-all
45cpplint-art-all:
Colin Cross6744a5c2017-07-14 12:45:27 -070046 $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070047
48OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint
49
Igor Murashkin2a2d3112017-11-14 15:03:25 -080050# Build up the list of all targets for linting the ART source files.
Brian Carlstrom05eecea2013-07-18 21:59:52 -070051ART_CPPLINT_TARGETS :=
52
53define declare-art-cpplint-target
54art_cpplint_file := $(1)
55art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file))
56
Igor Murashkin2a2d3112017-11-14 15:03:25 -080057$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) $(ART_CPPLINT_CFG) art/build/Android.cpplint.mk
58 $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $$<
Alex Light91de25f2015-10-28 17:00:06 -070059 $(hide) mkdir -p $$(dir $$@)
Brian Carlstrom05eecea2013-07-18 21:59:52 -070060 $(hide) touch $$@
61
62ART_CPPLINT_TARGETS += $$(art_cpplint_touch)
63endef
64
65$(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file))))
66#$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC))))
67
68include $(CLEAR_VARS)
69LOCAL_MODULE := cpplint-art-phony
70LOCAL_MODULE_TAGS := optional
71LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS)
72include $(BUILD_PHONY_PACKAGE)