blob: afe66a3a863c31153d94f13bcd79eb745e1930d4 [file] [log] [blame]
Dees Troy8d66f8b2013-10-08 14:04:55 +00001LOCAL_PATH:= system/core/toolbox/
2include $(CLEAR_VARS)
3
4TOOLS := \
5 start \
6 stop \
7 getprop \
8 setprop
9
10ifeq ($(TWHAVE_SELINUX), true)
11 TOOLS += \
12 ls \
13 getenforce \
14 setenforce \
15 chcon \
16 restorecon \
17 runcon \
18 getsebool \
19 setsebool \
20 load_policy
21endif
22
23LOCAL_SRC_FILES := \
Dees Troy8d66f8b2013-10-08 14:04:55 +000024 toolbox.c \
25 $(patsubst %,%.c,$(TOOLS))
26
Dees Troybb4c0cb2013-11-02 20:25:14 +000027ifneq ($(wildcard system/core/toolbox/dynarray.c),)
28 LOCAL_SRC_FILES += dynarray.c
Dees Troy8d66f8b2013-10-08 14:04:55 +000029endif
30
Dees Troybb4c0cb2013-11-02 20:25:14 +000031# 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 Troy8d66f8b2013-10-08 14:04:55 +000040LOCAL_C_INCLUDES := bionic/libc/bionic
41
42LOCAL_SHARED_LIBRARIES := \
43 libcutils \
44 liblog \
45 libc
46
47ifeq ($(TWHAVE_SELINUX), true)
48 LOCAL_SHARED_LIBRARIES += libselinux
49endif
50
51LOCAL_MODULE := toolbox_recovery
52LOCAL_MODULE_STEM := toolbox
53LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
54LOCAL_MODULE_TAGS := optional
55
56# Including this will define $(intermediates).
57#
58include $(BUILD_EXECUTABLE)
59
60$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
61
62TOOLS_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#
71SYMLINKS := $(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
79ALL_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
83ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
84 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)