14def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# Copyright (C) 2014 The Android Open Source Project
24def697734f9ea783f600ad77f77080dbdfaa6beYing Wang#
34def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# Licensed under the Apache License, Version 2.0 (the "License");
44def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# you may not use this file except in compliance with the License.
54def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# You may obtain a copy of the License at
64def697734f9ea783f600ad77f77080dbdfaa6beYing Wang#
74def697734f9ea783f600ad77f77080dbdfaa6beYing Wang#      http://www.apache.org/licenses/LICENSE-2.0
84def697734f9ea783f600ad77f77080dbdfaa6beYing Wang#
94def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# Unless required by applicable law or agreed to in writing, software
104def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# distributed under the License is distributed on an "AS IS" BASIS,
114def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# See the License for the specific language governing permissions and
134def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# limitations under the License.
144def697734f9ea783f600ad77f77080dbdfaa6beYing Wang
154def697734f9ea783f600ad77f77080dbdfaa6beYing WangLOCAL_PATH:= $(call my-dir)
164def697734f9ea783f600ad77f77080dbdfaa6beYing Wang# Don't include in unbundled build.
174def697734f9ea783f600ad77f77080dbdfaa6beYing Wangifeq ($(TARGET_BUILD_APPS),)
18f62fcdec92e2f96ec61579392ed2b593cff35b39Chris Banes
1982b55491586ac50a0f95b60e39a3c18d068941cfChris BanesSUPPORT_CURRENT_SDK_VERSION := current
20f62fcdec92e2f96ec61579392ed2b593cff35b39Chris Banes
215fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette###########################################################
225fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# Find all of the files in the given subdirs that match the
235fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# specified pattern but do not match another pattern. This
245fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# function uses $(1) instead of LOCAL_PATH as the base.
255fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# $(1): the base dir, relative to the root of the source tree.
265fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# $(2): the file name pattern to match.
275fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# $(3): the file name pattern to exclude.
285fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# $(4): a list of subdirs of the base dir.
295fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# Returns: a list of paths relative to the base dir.
305fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette###########################################################
315fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
325fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverettedefine find-files-in-subdirs-exclude
335fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette$(sort $(patsubst ./%,%, \
345fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette  $(shell cd $(1) ; \
355fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette          find -L $(4) -name $(2) -and -not -name $(3) -and -not -name ".*") \
365fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette ))
375fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viveretteendef
385fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
395fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette###########################################################
405fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette## Find all of the files under the named directories where
415fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette## the file name matches the specified pattern but does not
425fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette## match another pattern. Meant to be used like:
435fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette##    SRC_FILES := $(call all-named-files-under,.*\.h,src tests)
445fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette###########################################################
455fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
465fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverettedefine all-named-files-under-exclude
475fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette$(call find-files-in-subdirs-exclude,$(LOCAL_PATH),"$(1)","$(2)",$(3))
485fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viveretteendef
495fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
505fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette###########################################################
515fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette## Find all of the files under the current directory where
525fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette## the file name matches the specified pattern but does not
535fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette## match another pattern.
545fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette###########################################################
555fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
565fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverettedefine all-subdir-named-files-exclude
575fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette$(call all-named-files-under-exclude,$(1),$(2),.)
585fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viveretteendef
595fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
605fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette# Pre-process support library AIDLs
615fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viveretteaidl_files := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files-exclude,*.aidl,I*.aidl))
625fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverettesupport-aidl := $(TARGET_OUT_COMMON_INTERMEDIATES)/support.aidl
635fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette$(support-aidl): $(aidl_files) | $(AIDL)
645fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette	$(AIDL) --preprocess $@ $(aidl_files)
655fa0050c86de83e2fce4f2bf818bbc9230589a7cAlan Viverette
66f62fcdec92e2f96ec61579392ed2b593cff35b39Chris Banes# Build all support libraries
674def697734f9ea783f600ad77f77080dbdfaa6beYing Wanginclude $(call all-makefiles-under,$(LOCAL_PATH))
68f62fcdec92e2f96ec61579392ed2b593cff35b39Chris Banes
69f62fcdec92e2f96ec61579392ed2b593cff35b39Chris Banes# Clear out variables
7082b55491586ac50a0f95b60e39a3c18d068941cfChris BanesSUPPORT_CURRENT_SDK_VERSION :=
71f62fcdec92e2f96ec61579392ed2b593cff35b39Chris Banes
724def697734f9ea783f600ad77f77080dbdfaa6beYing Wangendif
73