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