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 19# Use upstream cpplint (toolpath from .repo/manifests/GLOBAL-PREUPLOAD.cfg). 20ART_CPPLINT := external/google-styleguide/cpplint/cpplint.py 21 22# 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. 31# 2) Prepends 'art/' to each of them to make the full name. 32ART_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)) 37 38# "mm cpplint-art" to verify we aren't regressing 39# - files not touched since the last build are skipped (quite fast). 40.PHONY: cpplint-art 41cpplint-art: cpplint-art-phony 42 43# "mm cpplint-art-all" to manually execute cpplint.py on all files (very slow). 44.PHONY: cpplint-art-all 45cpplint-art-all: 46 $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC) 47 48OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint 49 50# Build up the list of all targets for linting the ART source files. 51ART_CPPLINT_TARGETS := 52 53define declare-art-cpplint-target 54art_cpplint_file := $(1) 55art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file)) 56 57$$(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) $$< 59 $(hide) mkdir -p $$(dir $$@) 60 $(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) 73