blob: be140b500e5e0c1fcc4eb8cb4c66fce44fee682d [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Copyright (C) 2008 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)
Mark Salyzyn073a9eb2015-04-15 12:53:39 -070016
The Android Open Source Project88b60792009-03-03 19:28:42 -080017include $(CLEAR_VARS)
18
The Android Open Source Project88b60792009-03-03 19:28:42 -080019LOCAL_SRC_FILES := fs_config.c
20LOCAL_MODULE := fs_config
Mark Salyzyn073a9eb2015-04-15 12:53:39 -070021LOCAL_SHARED_LIBRARIES := libcutils libselinux
Mark Salyzyn1c5f19e2015-04-01 12:54:46 -070022LOCAL_CFLAGS := -Werror
The Android Open Source Project88b60792009-03-03 19:28:42 -080023
24include $(BUILD_HOST_EXECUTABLE)
Mark Salyzyn06b91b92015-04-01 14:41:29 -070025
26# To Build the custom target binary for the host to generate the fs_config
27# override files. The executable is hard coded to include the
28# $(TARGET_ANDROID_FILESYSTEM_CONFIG_H) file if it exists.
29# Expectations:
30# device/<vendor>/<device>/android_filesystem_config.h
31# fills in struct fs_path_config android_device_dirs[] and
32# struct fs_path_config android_device_files[]
33# device/<vendor>/<device>/device.mk
34# PRODUCT_PACKAGES += fs_config_dirs fs_config_files
35
36# If not specified, check if default one to be found
37ANDROID_FS_CONFIG_H := android_filesystem_config.h
38
39ifneq ($(TARGET_ANDROID_FILESYSTEM_CONFIG_H),)
William Roberts78626c42016-02-11 10:35:07 -080040
41# One and only one file can be specified.
42ifneq ($(words $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)),1)
43$(error Multiple fs_config files specified, \
44 see "$(TARGET_ANDROID_FILESYSTEM_CONFIG_H)".)
45endif
46
Mark Salyzyn06b91b92015-04-01 14:41:29 -070047ifeq ($(filter %/$(ANDROID_FS_CONFIG_H),$(TARGET_ANDROID_FILESYSTEM_CONFIG_H)),)
48$(error TARGET_ANDROID_FILESYSTEM_CONFIG_H file name must be $(ANDROID_FS_CONFIG_H), \
49 see "$(notdir $(TARGET_ANDROID_FILESYSTEM_CONFIG_H))".)
50endif
51
52my_fs_config_h := $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)
53else ifneq ($(wildcard $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)),)
54my_fs_config_h := $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)
55else
56my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
57endif
58
59include $(CLEAR_VARS)
60LOCAL_SRC_FILES := fs_config_generate.c
61LOCAL_MODULE := fs_config_generate_$(TARGET_DEVICE)
62LOCAL_SHARED_LIBRARIES := libcutils
63LOCAL_CFLAGS := -Werror -Wno-error=\#warnings
64LOCAL_C_INCLUDES := $(dir $(my_fs_config_h))
65include $(BUILD_HOST_EXECUTABLE)
66fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE)
67
68# Generate the system/etc/fs_config_dirs binary file for the target
69# Add fs_config_dirs to PRODUCT_PACKAGES in the device make file to enable
70include $(CLEAR_VARS)
71
72LOCAL_MODULE := fs_config_dirs
73LOCAL_MODULE_CLASS := ETC
74include $(BUILD_SYSTEM)/base_rules.mk
75$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
76 @mkdir -p $(dir $@)
77 $< -D -o $@
78
79# Generate the system/etc/fs_config_files binary file for the target
80# Add fs_config_files to PRODUCT_PACKAGES in the device make file to enable
81include $(CLEAR_VARS)
82
83LOCAL_MODULE := fs_config_files
84LOCAL_MODULE_CLASS := ETC
85include $(BUILD_SYSTEM)/base_rules.mk
86$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
87 @mkdir -p $(dir $@)
88 $< -F -o $@
89
90ANDROID_FS_CONFIG_H :=
91my_fs_config_h :=
92fs_config_generate_bin :=