Dees Troy | 8d66f8b | 2013-10-08 14:04:55 +0000 | [diff] [blame] | 1 | LOCAL_PATH:= system/core/toolbox/ |
| 2 | include $(CLEAR_VARS) |
| 3 | |
| 4 | TOOLS := \ |
| 5 | start \ |
| 6 | stop \ |
| 7 | getprop \ |
| 8 | setprop |
| 9 | |
| 10 | ifeq ($(TWHAVE_SELINUX), true) |
| 11 | TOOLS += \ |
| 12 | ls \ |
| 13 | getenforce \ |
| 14 | setenforce \ |
| 15 | chcon \ |
| 16 | restorecon \ |
| 17 | runcon \ |
| 18 | getsebool \ |
| 19 | setsebool \ |
| 20 | load_policy |
| 21 | endif |
| 22 | |
| 23 | LOCAL_SRC_FILES := \ |
Dees Troy | 8d66f8b | 2013-10-08 14:04:55 +0000 | [diff] [blame] | 24 | toolbox.c \ |
| 25 | $(patsubst %,%.c,$(TOOLS)) |
| 26 | |
Dees Troy | bb4c0cb | 2013-11-02 20:25:14 +0000 | [diff] [blame] | 27 | ifneq ($(wildcard system/core/toolbox/dynarray.c),) |
| 28 | LOCAL_SRC_FILES += dynarray.c |
Dees Troy | 8d66f8b | 2013-10-08 14:04:55 +0000 | [diff] [blame] | 29 | endif |
| 30 | |
Dees Troy | bb4c0cb | 2013-11-02 20:25:14 +0000 | [diff] [blame] | 31 | # reboot.c was removed in 4.4 kitkat |
| 32 | #TOOLS += reboot |
| 33 | |
| 34 | #ifeq ($(BOARD_USES_BOOTMENU),true) |
| 35 | # LOCAL_SRC_FILES += ../../../external/bootmenu/libreboot/reboot.c |
| 36 | #else |
| 37 | # LOCAL_SRC_FILES += reboot.c |
| 38 | #endif |
| 39 | |
Dees Troy | 8d66f8b | 2013-10-08 14:04:55 +0000 | [diff] [blame] | 40 | LOCAL_C_INCLUDES := bionic/libc/bionic |
| 41 | |
| 42 | LOCAL_SHARED_LIBRARIES := \ |
| 43 | libcutils \ |
| 44 | liblog \ |
| 45 | libc |
| 46 | |
| 47 | ifeq ($(TWHAVE_SELINUX), true) |
| 48 | LOCAL_SHARED_LIBRARIES += libselinux |
| 49 | endif |
| 50 | |
| 51 | LOCAL_MODULE := toolbox_recovery |
| 52 | LOCAL_MODULE_STEM := toolbox |
| 53 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin |
| 54 | LOCAL_MODULE_TAGS := optional |
| 55 | |
| 56 | # Including this will define $(intermediates). |
| 57 | # |
| 58 | include $(BUILD_EXECUTABLE) |
| 59 | |
| 60 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 61 | |
| 62 | TOOLS_H := $(intermediates)/tools.h |
| 63 | $(TOOLS_H): PRIVATE_TOOLS := $(TOOLS) |
| 64 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 65 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 66 | $(TOOLS_H): |
| 67 | $(transform-generated-source) |
| 68 | |
| 69 | # Make #!/system/bin/toolbox launchers for each tool. |
| 70 | # |
| 71 | SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(TOOLS)) |
| 72 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE_STEM) |
| 73 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 74 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 75 | @mkdir -p $(dir $@) |
| 76 | @rm -rf $@ |
| 77 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |
| 78 | |
| 79 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 80 | |
| 81 | # We need this so that the installed files could be picked up based on the |
| 82 | # local module name |
| 83 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 84 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |