| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) | 
|  | 2 | include $(CLEAR_VARS) | 
|  | 3 |  | 
|  | 4 | TOOLS := \ | 
|  | 5 | ls \ | 
|  | 6 | mount \ | 
|  | 7 | cat \ | 
|  | 8 | ps \ | 
|  | 9 | kill \ | 
|  | 10 | ln \ | 
|  | 11 | insmod \ | 
|  | 12 | rmmod \ | 
|  | 13 | lsmod \ | 
|  | 14 | ifconfig \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 15 | rm \ | 
|  | 16 | mkdir \ | 
|  | 17 | rmdir \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 18 | getevent \ | 
|  | 19 | sendevent \ | 
|  | 20 | date \ | 
|  | 21 | wipe \ | 
|  | 22 | sync \ | 
|  | 23 | umount \ | 
|  | 24 | start \ | 
|  | 25 | stop \ | 
|  | 26 | notify \ | 
|  | 27 | cmp \ | 
|  | 28 | dmesg \ | 
|  | 29 | route \ | 
|  | 30 | hd \ | 
|  | 31 | dd \ | 
|  | 32 | df \ | 
|  | 33 | getprop \ | 
|  | 34 | setprop \ | 
|  | 35 | watchprops \ | 
|  | 36 | log \ | 
|  | 37 | sleep \ | 
|  | 38 | renice \ | 
|  | 39 | printenv \ | 
|  | 40 | smd \ | 
|  | 41 | chmod \ | 
| Dries Harnie | 2a74373 | 2010-01-18 17:44:33 +0100 | [diff] [blame] | 42 | chown \ | 
| San Mehat | 72eead4 | 2009-07-06 11:10:03 -0700 | [diff] [blame] | 43 | newfs_msdos \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 44 | netstat \ | 
|  | 45 | ioctl \ | 
|  | 46 | mv \ | 
|  | 47 | schedtop \ | 
|  | 48 | top \ | 
|  | 49 | iftop \ | 
|  | 50 | id \ | 
| Mike Lockwood | a699d62 | 2010-04-09 15:27:16 -0400 | [diff] [blame] | 51 | uptime \ | 
| Arve Hjønnevåg | 7c953d0 | 2009-09-17 17:30:55 -0700 | [diff] [blame] | 52 | vmstat \ | 
| San Mehat | 10d469b | 2010-02-25 14:02:55 -0800 | [diff] [blame] | 53 | nandread \ | 
| Kenny Root | 8b9b105 | 2010-07-27 09:20:02 -0700 | [diff] [blame] | 54 | ionice \ | 
| Ken Sumrall | 795165b | 2011-04-05 20:46:30 -0700 | [diff] [blame] | 55 | touch \ | 
| Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 56 | lsof \ | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 57 | du \ | 
| Michael Wright | 52abb4b | 2012-07-15 15:52:50 -0700 | [diff] [blame] | 58 | md5 \ | 
| Kenny Root | efb5e3c | 2012-10-16 18:00:29 -0700 | [diff] [blame] | 59 | clear \ | 
| Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 60 | getenforce \ | 
|  | 61 | setenforce \ | 
|  | 62 | chcon \ | 
|  | 63 | restorecon \ | 
|  | 64 | runcon \ | 
|  | 65 | getsebool \ | 
|  | 66 | setsebool \ | 
| Rom Lemarchand | 367297c | 2013-06-05 13:25:12 -0700 | [diff] [blame] | 67 | load_policy \ | 
|  | 68 | swapon \ | 
|  | 69 | swapoff \ | 
| Michael Wright | 9f50abd | 2013-08-19 15:56:34 -0700 | [diff] [blame] | 70 | mkswap \ | 
| Glenn Kasten | 3707e7f | 2013-09-23 15:10:12 -0700 | [diff] [blame] | 71 | readlink \ | 
| Sujith Ramakrishnan | 71bbbd1 | 2014-01-14 16:57:22 -0800 | [diff] [blame] | 72 | mknod \ | 
| Glenn Kasten | 3707e7f | 2013-09-23 15:10:12 -0700 | [diff] [blame] | 73 | nohup | 
| Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 74 |  | 
| Erik Gilling | b76f0ff | 2011-04-28 14:23:26 -0700 | [diff] [blame] | 75 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) | 
|  | 76 | TOOLS += r | 
|  | 77 | endif | 
|  | 78 |  | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 79 | ALL_TOOLS = $(TOOLS) | 
|  | 80 | ALL_TOOLS += \ | 
| Jeff Sharkey | 3e8b158 | 2012-07-13 16:37:13 -0700 | [diff] [blame] | 81 | cp \ | 
|  | 82 | grep | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 83 |  | 
|  | 84 | LOCAL_SRC_FILES := \ | 
| David 'Digit' Turner | a8d1afb | 2011-01-06 08:39:44 +0100 | [diff] [blame] | 85 | dynarray.c \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 86 | toolbox.c \ | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 87 | $(patsubst %,%.c,$(TOOLS)) \ | 
| Jeff Sharkey | 3e8b158 | 2012-07-13 16:37:13 -0700 | [diff] [blame] | 88 | 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 Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 90 |  | 
| Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 91 | LOCAL_C_INCLUDES := bionic/libc/bionic | 
|  | 92 |  | 
| Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 93 | LOCAL_CFLAGS += -Wno-unused-parameter | 
|  | 94 |  | 
| Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 95 | LOCAL_SHARED_LIBRARIES := \ | 
|  | 96 | libcutils \ | 
| Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame] | 97 | liblog \ | 
| Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 98 | libc \ | 
|  | 99 | libusbhost \ | 
|  | 100 | libselinux | 
| Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 101 |  | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 102 | LOCAL_MODULE := toolbox | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 103 |  | 
|  | 104 | # Including this will define $(intermediates). | 
|  | 105 | # | 
|  | 106 | include $(BUILD_EXECUTABLE) | 
|  | 107 |  | 
|  | 108 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h | 
|  | 109 |  | 
|  | 110 | TOOLS_H := $(intermediates)/tools.h | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 111 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 112 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done | 
|  | 113 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk | 
|  | 114 | $(TOOLS_H): | 
|  | 115 | $(transform-generated-source) | 
|  | 116 |  | 
|  | 117 | # Make #!/system/bin/toolbox launchers for each tool. | 
|  | 118 | # | 
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 119 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS)) | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 120 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) | 
|  | 121 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk | 
|  | 122 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" | 
|  | 123 | @mkdir -p $(dir $@) | 
|  | 124 | @rm -rf $@ | 
|  | 125 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ | 
|  | 126 |  | 
|  | 127 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) | 
|  | 128 |  | 
|  | 129 | # We need this so that the installed files could be picked up based on the | 
|  | 130 | # local module name | 
|  | 131 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ | 
|  | 132 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |