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