Home | History | Annotate | Download | only in fs_config
      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 
     15 LOCAL_PATH := $(call my-dir)
     16 
     17 include $(CLEAR_VARS)
     18 
     19 LOCAL_SRC_FILES := fs_config.c
     20 LOCAL_MODULE := fs_config
     21 LOCAL_SHARED_LIBRARIES := libcutils libselinux
     22 LOCAL_CFLAGS := -Werror
     23 
     24 include $(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
     37 ANDROID_FS_CONFIG_H := android_filesystem_config.h
     38 
     39 ifneq ($(TARGET_ANDROID_FILESYSTEM_CONFIG_H),)
     40 ifeq ($(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))".)
     43 endif
     44 
     45 my_fs_config_h := $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)
     46 else ifneq ($(wildcard $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)),)
     47 my_fs_config_h := $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)
     48 else
     49 my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
     50 endif
     51 
     52 include $(CLEAR_VARS)
     53 LOCAL_SRC_FILES := fs_config_generate.c
     54 LOCAL_MODULE := fs_config_generate_$(TARGET_DEVICE)
     55 LOCAL_SHARED_LIBRARIES := libcutils
     56 LOCAL_CFLAGS := -Werror -Wno-error=\#warnings
     57 LOCAL_C_INCLUDES := $(dir $(my_fs_config_h))
     58 include $(BUILD_HOST_EXECUTABLE)
     59 fs_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
     63 include $(CLEAR_VARS)
     64 
     65 LOCAL_MODULE := fs_config_dirs
     66 LOCAL_MODULE_CLASS := ETC
     67 include $(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
     74 include $(CLEAR_VARS)
     75 
     76 LOCAL_MODULE := fs_config_files
     77 LOCAL_MODULE_CLASS := ETC
     78 include $(BUILD_SYSTEM)/base_rules.mk
     79 $(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
     80 	@mkdir -p $(dir $@)
     81 	$< -F -o $@
     82 
     83 ANDROID_FS_CONFIG_H :=
     84 my_fs_config_h :=
     85 fs_config_generate_bin :=
     86