Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 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 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 17 | include art/build/Android.common_build.mk |
| 18 | |
Alex Light | 80c0d79 | 2016-01-12 11:10:23 -0800 | [diff] [blame] | 19 | ART_CPPLINT := $(LOCAL_PATH)/tools/cpplint.py |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 20 | ART_CPPLINT_FILTER := --filter=-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references,-runtime/sizeof,-runtime/threadsafe_fn,-runtime/printf |
Colin Cross | cf2bd73 | 2017-07-30 10:32:01 -0700 | [diff] [blame] | 21 | # Use `pwd` instead of $TOP for root, $TOP is always . and --root doesn't seem |
| 22 | # to work with a relative path (b/34787652). |
| 23 | ART_CPPLINT_FLAGS := --root=`pwd` |
Colin Cross | 6744a5c | 2017-07-14 12:45:27 -0700 | [diff] [blame] | 24 | ART_CPPLINT_QUIET := --quiet |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 25 | ART_CPPLINT_INGORED := \ |
| 26 | runtime/elf.h \ |
Andreas Gampe | 06c42a5 | 2017-07-26 14:17:14 -0700 | [diff] [blame] | 27 | openjdkjvmti/include/jvmti.h |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 28 | |
Alex Light | 80c0d79 | 2016-01-12 11:10:23 -0800 | [diff] [blame] | 29 | # This: |
| 30 | # 1) Gets a list of all .h & .cc files in the art directory. |
| 31 | # 2) Prepends 'art/' to each of them to make the full name. |
| 32 | # 3) removes art/runtime/elf.h from the list. |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 33 | ART_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 Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 34 | |
| 35 | # "mm cpplint-art" to verify we aren't regressing |
| 36 | .PHONY: cpplint-art |
| 37 | cpplint-art: |
Colin Cross | 6744a5c | 2017-07-14 12:45:27 -0700 | [diff] [blame] | 38 | $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $(ART_CPPLINT_SRC) |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 39 | |
| 40 | # "mm cpplint-art-all" to see all warnings |
| 41 | .PHONY: cpplint-art-all |
| 42 | cpplint-art-all: |
Colin Cross | 6744a5c | 2017-07-14 12:45:27 -0700 | [diff] [blame] | 43 | $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC) |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 44 | |
| 45 | OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint |
| 46 | |
| 47 | ART_CPPLINT_TARGETS := |
| 48 | |
| 49 | define declare-art-cpplint-target |
| 50 | art_cpplint_file := $(1) |
| 51 | art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file)) |
| 52 | |
| 53 | $$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) art/build/Android.cpplint.mk |
Colin Cross | 6744a5c | 2017-07-14 12:45:27 -0700 | [diff] [blame] | 54 | $(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $$< |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame] | 55 | $(hide) mkdir -p $$(dir $$@) |
Brian Carlstrom | 05eecea | 2013-07-18 21:59:52 -0700 | [diff] [blame] | 56 | $(hide) touch $$@ |
| 57 | |
| 58 | ART_CPPLINT_TARGETS += $$(art_cpplint_touch) |
| 59 | endef |
| 60 | |
| 61 | $(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file)))) |
| 62 | #$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC)))) |
| 63 | |
| 64 | include $(CLEAR_VARS) |
| 65 | LOCAL_MODULE := cpplint-art-phony |
| 66 | LOCAL_MODULE_TAGS := optional |
| 67 | LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS) |
| 68 | include $(BUILD_PHONY_PACKAGE) |