blob: c5890b2c8780285931c301c2e6825c8663d36e25 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4TOOLS := \
5 ls \
6 mount \
7 cat \
8 ps \
9 kill \
10 ln \
11 insmod \
12 rmmod \
13 lsmod \
14 ifconfig \
15 setconsole \
16 rm \
17 mkdir \
18 rmdir \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080019 getevent \
20 sendevent \
21 date \
22 wipe \
23 sync \
24 umount \
25 start \
26 stop \
27 notify \
28 cmp \
29 dmesg \
30 route \
31 hd \
32 dd \
33 df \
34 getprop \
35 setprop \
36 watchprops \
37 log \
38 sleep \
39 renice \
40 printenv \
41 smd \
42 chmod \
Dries Harnie2a743732010-01-18 17:44:33 +010043 chown \
San Mehat72eead42009-07-06 11:10:03 -070044 newfs_msdos \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080045 netstat \
46 ioctl \
47 mv \
48 schedtop \
49 top \
50 iftop \
51 id \
Mike Lockwooda699d622010-04-09 15:27:16 -040052 uptime \
Arve Hjønnevåg7c953d02009-09-17 17:30:55 -070053 vmstat \
San Mehat10d469b2010-02-25 14:02:55 -080054 nandread \
Kenny Root8b9b1052010-07-27 09:20:02 -070055 ionice \
Ken Sumrall795165b2011-04-05 20:46:30 -070056 touch \
Scott Andersond0455c92012-01-11 18:13:26 -080057 lsof \
Jeff Sharkey57df14c2012-07-13 16:25:33 -070058 du \
Michael Wright52abb4b2012-07-15 15:52:50 -070059 md5 \
Kenny Rootefb5e3c2012-10-16 18:00:29 -070060 clear \
Stephen Smalley8290d102012-01-13 08:53:56 -050061 getenforce \
62 setenforce \
63 chcon \
64 restorecon \
65 runcon \
66 getsebool \
67 setsebool \
Rom Lemarchand367297c2013-06-05 13:25:12 -070068 load_policy \
69 swapon \
70 swapoff \
Michael Wright9f50abd2013-08-19 15:56:34 -070071 mkswap \
Glenn Kasten3707e7f2013-09-23 15:10:12 -070072 readlink \
73 nohup
Stephen Smalley8290d102012-01-13 08:53:56 -050074
Erik Gillingb76f0ff2011-04-28 14:23:26 -070075ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
76TOOLS += r
77endif
78
Jeff Sharkey57df14c2012-07-13 16:25:33 -070079ALL_TOOLS = $(TOOLS)
80ALL_TOOLS += \
Jeff Sharkey3e8b1582012-07-13 16:37:13 -070081 cp \
82 grep
Jeff Sharkey57df14c2012-07-13 16:25:33 -070083
84LOCAL_SRC_FILES := \
David 'Digit' Turnera8d1afb2011-01-06 08:39:44 +010085 dynarray.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080086 toolbox.c \
Jeff Sharkey57df14c2012-07-13 16:25:33 -070087 $(patsubst %,%.c,$(TOOLS)) \
Jeff Sharkey3e8b1582012-07-13 16:37:13 -070088 cp/cp.c cp/utils.c \
89 grep/grep.c grep/fastgrep.c grep/file.c grep/queue.c grep/util.c
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080090
Scott Andersond0455c92012-01-11 18:13:26 -080091LOCAL_C_INCLUDES := bionic/libc/bionic
92
Kenny Rootb83c0982012-10-10 11:26:33 -070093LOCAL_SHARED_LIBRARIES := \
94 libcutils \
Ying Wang083b5cc2013-04-09 22:03:45 -070095 liblog \
Kenny Rootb83c0982012-10-10 11:26:33 -070096 libc \
97 libusbhost \
98 libselinux
Stephen Smalley8290d102012-01-13 08:53:56 -050099
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700100LOCAL_MODULE := toolbox
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800101
102# Including this will define $(intermediates).
103#
104include $(BUILD_EXECUTABLE)
105
106$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
107
108TOOLS_H := $(intermediates)/tools.h
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700109$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800110$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
111$(TOOLS_H): $(LOCAL_PATH)/Android.mk
112$(TOOLS_H):
113 $(transform-generated-source)
114
115# Make #!/system/bin/toolbox launchers for each tool.
116#
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700117SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800118$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE)
119$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
120 @echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
121 @mkdir -p $(dir $@)
122 @rm -rf $@
123 $(hide) ln -sf $(TOOLBOX_BINARY) $@
124
125ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
126
127# We need this so that the installed files could be picked up based on the
128# local module name
129ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
130 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)