1 # -*- mode: makefile -*- 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 LOCAL_PATH := $(call my-dir) 17 18 # 19 # Definitions for installing Certificate Authority (CA) certificates 20 # 21 22 define all-files-under 23 $(patsubst ./%,%, \ 24 $(shell cd $(LOCAL_PATH) ; \ 25 find $(1) -type f) \ 26 ) 27 endef 28 29 # $(1): module name 30 # $(2): source file 31 # $(3): destination directory 32 define include-prebuilt-with-destination-directory 33 include $$(CLEAR_VARS) 34 LOCAL_MODULE := $(1) 35 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 36 LOCAL_MODULE_STEM := $(notdir $(2)) 37 LOCAL_MODULE_TAGS := optional 38 LOCAL_MODULE_CLASS := ETC 39 LOCAL_MODULE_PATH := $(3) 40 LOCAL_SRC_FILES := $(2) 41 include $$(BUILD_PREBUILT) 42 endef 43 44 cacerts := $(call all-files-under,files) 45 46 cacerts_target_directory := $(TARGET_OUT)/etc/security/cacerts 47 $(foreach cacert, $(cacerts), $(eval $(call include-prebuilt-with-destination-directory,target-cacert-$(notdir $(cacert)),$(cacert),$(cacerts_target_directory)))) 48 cacerts_target := $(addprefix $(cacerts_target_directory)/,$(foreach cacert,$(cacerts),$(notdir $(cacert)))) 49 .PHONY: cacerts_target 50 cacerts: $(cacerts_target) 51 52 # This is so that build/target/product/core.mk can use cacerts in PRODUCT_PACKAGES 53 ALL_MODULES.cacerts.INSTALLED := $(cacerts_target) 54 55 cacerts_host_directory := $(HOST_OUT)/etc/security/cacerts 56 $(foreach cacert, $(cacerts), $(eval $(call include-prebuilt-with-destination-directory,host-cacert-$(notdir $(cacert)),$(cacert),$(cacerts_host_directory)))) 57 58 cacerts_host := $(addprefix $(cacerts_host_directory)/,$(foreach cacert,$(cacerts),$(notdir $(cacert)))) 59 .PHONY: cacerts-host 60 cacerts-host: $(cacerts_host) 61 62 include $(call all-makefiles-under,$(LOCAL_PATH)) 63