Home | History | Annotate | Download | only in build
      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 
     17 include art/build/Android.common_build.mk
     18 
     19 ART_CPPLINT := $(LOCAL_PATH)/tools/cpplint.py
     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
     21 ART_CPPLINT_FLAGS := --quiet --root=$(ANDROID_BUILD_TOP)
     22 ART_CPPLINT_INGORED := \
     23     runtime/elf.h \
     24     runtime/openjdkjvmti/include/jvmti.h
     25 
     26 # This:
     27 #  1) Gets a list of all .h & .cc files in the art directory.
     28 #  2) Prepends 'art/' to each of them to make the full name.
     29 #  3) removes art/runtime/elf.h from the list.
     30 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))))
     31 
     32 # "mm cpplint-art" to verify we aren't regressing
     33 .PHONY: cpplint-art
     34 cpplint-art:
     35 	$(ART_CPPLINT) $(ART_CPPLINT_FILTER) $(ART_CPPLINT_SRC)
     36 
     37 # "mm cpplint-art-all" to see all warnings
     38 .PHONY: cpplint-art-all
     39 cpplint-art-all:
     40 	$(ART_CPPLINT) $(ART_CPPLINT_SRC)
     41 
     42 OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint
     43 
     44 ART_CPPLINT_TARGETS :=
     45 
     46 define declare-art-cpplint-target
     47 art_cpplint_file := $(1)
     48 art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file))
     49 
     50 $$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) art/build/Android.cpplint.mk
     51 	$(hide) $(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $$<
     52 	$(hide) mkdir -p $$(dir $$@)
     53 	$(hide) touch $$@
     54 
     55 ART_CPPLINT_TARGETS += $$(art_cpplint_touch)
     56 endef
     57 
     58 $(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file))))
     59 #$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC))))
     60 
     61 include $(CLEAR_VARS)
     62 LOCAL_MODULE := cpplint-art-phony
     63 LOCAL_MODULE_TAGS := optional
     64 LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS)
     65 include $(BUILD_PHONY_PACKAGE)
     66