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 := \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 5 | cat \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 6 | chcon \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 7 | chmod \ |
Dries Harnie | 2a74373 | 2010-01-18 17:44:33 +0100 | [diff] [blame] | 8 | chown \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 9 | clear \ |
| 10 | cmp \ |
| 11 | date \ |
| 12 | dd \ |
| 13 | df \ |
| 14 | dmesg \ |
| 15 | du \ |
| 16 | getenforce \ |
| 17 | getevent \ |
| 18 | getprop \ |
| 19 | getsebool \ |
| 20 | hd \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 21 | id \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 22 | ifconfig \ |
| 23 | iftop \ |
| 24 | insmod \ |
| 25 | ioctl \ |
| 26 | ionice \ |
| 27 | kill \ |
| 28 | ln \ |
| 29 | load_policy \ |
| 30 | log \ |
| 31 | ls \ |
| 32 | lsmod \ |
| 33 | lsof \ |
| 34 | md5 \ |
| 35 | mkdir \ |
| 36 | mkswap \ |
| 37 | mount \ |
| 38 | mv \ |
| 39 | nandread \ |
| 40 | netstat \ |
| 41 | newfs_msdos \ |
Glenn Kasten | 38e5f07 | 2013-09-23 15:10:12 -0700 | [diff] [blame^] | 42 | nohup \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 43 | notify \ |
| 44 | printenv \ |
| 45 | ps \ |
| 46 | readlink \ |
| 47 | renice \ |
| 48 | restorecon \ |
| 49 | rm \ |
| 50 | rmdir \ |
| 51 | rmmod \ |
| 52 | route \ |
| 53 | runcon \ |
| 54 | schedtop \ |
| 55 | sendevent \ |
| 56 | setenforce \ |
| 57 | setprop \ |
| 58 | setsebool \ |
| 59 | sleep \ |
| 60 | smd \ |
| 61 | start \ |
| 62 | stop \ |
| 63 | swapoff \ |
| 64 | swapon \ |
| 65 | sync \ |
| 66 | top \ |
| 67 | touch \ |
| 68 | umount \ |
Mike Lockwood | a699d62 | 2010-04-09 15:27:16 -0400 | [diff] [blame] | 69 | uptime \ |
Arve Hjønnevåg | 7c953d0 | 2009-09-17 17:30:55 -0700 | [diff] [blame] | 70 | vmstat \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 71 | watchprops \ |
| 72 | wipe \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 73 | |
Erik Gilling | b76f0ff | 2011-04-28 14:23:26 -0700 | [diff] [blame] | 74 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 75 | TOOLS += r |
| 76 | endif |
| 77 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 78 | ALL_TOOLS = $(TOOLS) |
| 79 | ALL_TOOLS += \ |
Jeff Sharkey | 3e8b158 | 2012-07-13 16:37:13 -0700 | [diff] [blame] | 80 | cp \ |
| 81 | grep |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 82 | |
| 83 | LOCAL_SRC_FILES := \ |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 84 | cp/cp.c \ |
| 85 | cp/utils.c \ |
David 'Digit' Turner | a8d1afb | 2011-01-06 08:39:44 +0100 | [diff] [blame] | 86 | dynarray.c \ |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 87 | grep/fastgrep.c \ |
| 88 | grep/file.c \ |
| 89 | grep/grep.c \ |
| 90 | grep/queue.c \ |
| 91 | grep/util.c \ |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 92 | $(patsubst %,%.c,$(TOOLS)) \ |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 93 | toolbox.c \ |
| 94 | uid_from_user.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 95 | |
Elliott Hughes | 0b02467 | 2014-02-28 16:48:49 -0800 | [diff] [blame] | 96 | LOCAL_CFLAGS += \ |
Elliott Hughes | 5922d3b | 2014-04-18 16:53:04 -0700 | [diff] [blame] | 97 | -std=gnu99 \ |
Mark Salyzyn | aa90776 | 2014-05-08 09:31:43 -0700 | [diff] [blame] | 98 | -Werror -Wno-unused-parameter \ |
Elliott Hughes | 3f6b63e | 2014-02-28 17:25:17 -0800 | [diff] [blame] | 99 | -include bsd-compatibility.h \ |
Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 100 | |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 101 | LOCAL_C_INCLUDES += external/openssl/include |
| 102 | |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 103 | LOCAL_SHARED_LIBRARIES := \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 104 | libcrypto \ |
| 105 | libcutils \ |
| 106 | libselinux \ |
| 107 | |
| 108 | # libusbhost is only used by lsusb, and that isn't usually included in toolbox. |
| 109 | # The linker strips out all the unused library code in the normal case. |
| 110 | LOCAL_STATIC_LIBRARIES := \ |
| 111 | libusbhost \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 112 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 113 | LOCAL_MODULE := toolbox |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 114 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 115 | |
| 116 | # Including this will define $(intermediates). |
| 117 | # |
| 118 | include $(BUILD_EXECUTABLE) |
| 119 | |
| 120 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 121 | |
| 122 | TOOLS_H := $(intermediates)/tools.h |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 123 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 124 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 125 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 126 | $(TOOLS_H): |
| 127 | $(transform-generated-source) |
| 128 | |
| 129 | # Make #!/system/bin/toolbox launchers for each tool. |
| 130 | # |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 131 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS)) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 132 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) |
| 133 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 134 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 135 | @mkdir -p $(dir $@) |
| 136 | @rm -rf $@ |
| 137 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |
| 138 | |
| 139 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 140 | |
| 141 | # We need this so that the installed files could be picked up based on the |
| 142 | # local module name |
| 143 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 144 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |