1# 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) 16 17include $(CLEAR_VARS) 18 19LOCAL_SRC_FILES := fs_config.c 20LOCAL_MODULE := fs_config 21LOCAL_SHARED_LIBRARIES := libcutils libselinux 22LOCAL_CFLAGS := -Werror 23 24include $(BUILD_HOST_EXECUTABLE) 25 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),) 40ifeq ($(filter %/$(ANDROID_FS_CONFIG_H),$(TARGET_ANDROID_FILESYSTEM_CONFIG_H)),) 41$(error TARGET_ANDROID_FILESYSTEM_CONFIG_H file name must be $(ANDROID_FS_CONFIG_H), \ 42 see "$(notdir $(TARGET_ANDROID_FILESYSTEM_CONFIG_H))".) 43endif 44 45my_fs_config_h := $(TARGET_ANDROID_FILESYSTEM_CONFIG_H) 46else ifneq ($(wildcard $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)),) 47my_fs_config_h := $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H) 48else 49my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H) 50endif 51 52include $(CLEAR_VARS) 53LOCAL_SRC_FILES := fs_config_generate.c 54LOCAL_MODULE := fs_config_generate_$(TARGET_DEVICE) 55LOCAL_SHARED_LIBRARIES := libcutils 56LOCAL_CFLAGS := -Werror -Wno-error=\#warnings 57LOCAL_C_INCLUDES := $(dir $(my_fs_config_h)) 58include $(BUILD_HOST_EXECUTABLE) 59fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE) 60 61# Generate the system/etc/fs_config_dirs binary file for the target 62# Add fs_config_dirs to PRODUCT_PACKAGES in the device make file to enable 63include $(CLEAR_VARS) 64 65LOCAL_MODULE := fs_config_dirs 66LOCAL_MODULE_CLASS := ETC 67include $(BUILD_SYSTEM)/base_rules.mk 68$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin) 69 @mkdir -p $(dir $@) 70 $< -D -o $@ 71 72# Generate the system/etc/fs_config_files binary file for the target 73# Add fs_config_files to PRODUCT_PACKAGES in the device make file to enable 74include $(CLEAR_VARS) 75 76LOCAL_MODULE := fs_config_files 77LOCAL_MODULE_CLASS := ETC 78include $(BUILD_SYSTEM)/base_rules.mk 79$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin) 80 @mkdir -p $(dir $@) 81 $< -F -o $@ 82 83ANDROID_FS_CONFIG_H := 84my_fs_config_h := 85fs_config_generate_bin := 86