Android.mk revision 9562a3b639225d406d736b64a12e2d75459259e3
1# Copyright (C) 2014 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15LOCAL_PATH:= $(call my-dir) 16# Don't include in unbundled build. 17ifeq ($(TARGET_BUILD_APPS),) 18 19SUPPORT_CURRENT_SDK_VERSION := current 20 21########################################################### 22# Find all of the files in the given subdirs that match the 23# specified pattern but do not match another pattern. This 24# function uses $(1) instead of LOCAL_PATH as the base. 25# $(1): the base dir, relative to the root of the source tree. 26# $(2): the file name pattern to match. 27# $(3): the file name pattern to exclude. 28# $(4): a list of subdirs of the base dir. 29# Returns: a list of paths relative to the base dir. 30########################################################### 31 32define find-files-in-subdirs-exclude 33$(sort $(patsubst ./%,%, \ 34 $(shell cd $(1) ; \ 35 find -L $(4) -name $(2) -and -not -name $(3) -and -not -name ".*") \ 36 )) 37endef 38 39########################################################### 40## Find all of the files under the named directories where 41## the file name matches the specified pattern but does not 42## match another pattern. Meant to be used like: 43## SRC_FILES := $(call all-named-files-under,.*\.h,src tests) 44########################################################### 45 46define all-named-files-under-exclude 47$(call find-files-in-subdirs-exclude,$(LOCAL_PATH),"$(1)","$(2)",$(3)) 48endef 49 50########################################################### 51## Find all of the files under the current directory where 52## the file name matches the specified pattern but does not 53## match another pattern. 54########################################################### 55 56define all-subdir-named-files-exclude 57$(call all-named-files-under-exclude,$(1),$(2),.) 58endef 59 60# Proxy to gradle task for updating API 61.PHONY: update-support-api 62update-support-api: PRIVATE_LOCAL_PATH := $(LOCAL_PATH) 63update-support-api: 64 $(PRIVATE_LOCAL_PATH)/gradlew -p $(PRIVATE_LOCAL_PATH) updateApi 65 66# Proxy to gradle task for checking API 67.PHONY: check-support-api 68check-support-api: PRIVATE_LOCAL_PATH := $(LOCAL_PATH) 69check-support-api: 70 $(PRIVATE_LOCAL_PATH)/gradlew -p $(PRIVATE_LOCAL_PATH) checkApi 71 72# Proxy to gradle task for generating docs 73.PHONY: support-docs 74support-docs: PRIVATE_LOCAL_PATH := $(LOCAL_PATH) 75support-docs: 76 $(PRIVATE_LOCAL_PATH)/gradlew -p $(PRIVATE_LOCAL_PATH) generateDocs 77 78# Pre-process support library AIDLs 79aidl_files := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files-exclude,*.aidl,I*.aidl)) 80support-aidl := $(TARGET_OUT_COMMON_INTERMEDIATES)/support.aidl 81$(support-aidl): $(aidl_files) | $(AIDL) 82 $(AIDL) --preprocess $@ $(aidl_files) 83 84# Check APIs and generate support AIDL file for SDK build 85sdk: check-support-api $(support-aidl) 86 87# Build all support libraries 88include $(call all-makefiles-under,$(LOCAL_PATH)) 89 90# Clear out variables 91SUPPORT_CURRENT_SDK_VERSION := 92 93endif 94