blob: f85f52422d7ea96779981c139c3b2bf66dbe8019 [file] [log] [blame]
Brian Carlstrom347b2a62011-04-26 11:34:16 -07001# -*- 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#
17# Definitions for installing Certificate Authority (CA) certificates
18#
19
20define all-files-under
21$(patsubst ./%,%, \
22 $(shell cd $(LOCAL_PATH) ; \
23 find $(1) -type f) \
24 )
25endef
26
27# $(1): module name
28# $(2): source file
29# $(3): destination directory
30define include-prebuilt-with-destination-directory
31include $$(CLEAR_VARS)
32LOCAL_MODULE := $(1)
Elliott Hughes73d3e262012-08-28 17:56:09 -070033LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/CaCerts.mk
Brian Carlstrom347b2a62011-04-26 11:34:16 -070034LOCAL_MODULE_STEM := $(notdir $(2))
35LOCAL_MODULE_TAGS := optional
36LOCAL_MODULE_CLASS := ETC
37LOCAL_MODULE_PATH := $(3)
38LOCAL_SRC_FILES := $(2)
39include $$(BUILD_PREBUILT)
40endef
41
42cacerts := $(call all-files-under,luni/src/main/files/cacerts)
43
44cacerts_target_directory := $(TARGET_OUT)/etc/security/cacerts
45$(foreach cacert, $(cacerts), $(eval $(call include-prebuilt-with-destination-directory,target-cacert-$(notdir $(cacert)),$(cacert),$(cacerts_target_directory))))
46cacerts_target := $(addprefix $(cacerts_target_directory)/,$(foreach cacert,$(cacerts),$(notdir $(cacert))))
47.PHONY: cacerts_target
48cacerts: $(cacerts_target)
49
50# This is so that build/target/product/core.mk can use cacerts in PRODUCT_PACKAGES
51ALL_MODULES.cacerts.INSTALLED := $(cacerts_target)
52
Brian Carlstrom347b2a62011-04-26 11:34:16 -070053cacerts_host_directory := $(HOST_OUT)/etc/security/cacerts
54$(foreach cacert, $(cacerts), $(eval $(call include-prebuilt-with-destination-directory,host-cacert-$(notdir $(cacert)),$(cacert),$(cacerts_host_directory))))
Ian Rogers3deabd22014-05-23 15:12:42 -070055
Brian Carlstrom347b2a62011-04-26 11:34:16 -070056cacerts_host := $(addprefix $(cacerts_host_directory)/,$(foreach cacert,$(cacerts),$(notdir $(cacert))))
57.PHONY: cacerts-host
58cacerts-host: $(cacerts_host)