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 := \ |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 85 | cp/cp.c \ |
| 86 | cp/utils.c \ |
David 'Digit' Turner | a8d1afb | 2011-01-06 08:39:44 +0100 | [diff] [blame] | 87 | dynarray.c \ |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 88 | grep/fastgrep.c \ |
| 89 | grep/file.c \ |
| 90 | grep/grep.c \ |
| 91 | grep/queue.c \ |
| 92 | grep/util.c \ |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 93 | $(patsubst %,%.c,$(TOOLS)) \ |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 94 | toolbox.c \ |
| 95 | uid_from_user.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 96 | |
Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 97 | LOCAL_C_INCLUDES := bionic/libc/bionic |
| 98 | |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 99 | LOCAL_CFLAGS += \ |
| 100 | -Wno-unused-parameter \ |
Elliott Hughes | 3f6b63e | 2014-02-28 17:25:17 -0800 | [diff] [blame] | 101 | -include bsd-compatibility.h \ |
Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 102 | |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 103 | LOCAL_SHARED_LIBRARIES := \ |
| 104 | libcutils \ |
Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame] | 105 | liblog \ |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 106 | libc \ |
| 107 | libusbhost \ |
| 108 | libselinux |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 109 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 110 | LOCAL_MODULE := toolbox |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 111 | |
| 112 | # Including this will define $(intermediates). |
| 113 | # |
| 114 | include $(BUILD_EXECUTABLE) |
| 115 | |
| 116 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 117 | |
| 118 | TOOLS_H := $(intermediates)/tools.h |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 119 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 120 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 121 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 122 | $(TOOLS_H): |
| 123 | $(transform-generated-source) |
| 124 | |
| 125 | # Make #!/system/bin/toolbox launchers for each tool. |
| 126 | # |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 127 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS)) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 128 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) |
| 129 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 130 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 131 | @mkdir -p $(dir $@) |
| 132 | @rm -rf $@ |
| 133 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |
| 134 | |
| 135 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 136 | |
| 137 | # We need this so that the installed files could be picked up based on the |
| 138 | # local module name |
| 139 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 140 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |