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