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 \ |
| 15 | setconsole \ |
| 16 | rm \ |
| 17 | mkdir \ |
| 18 | rmdir \ |
| 19 | reboot \ |
| 20 | getevent \ |
| 21 | sendevent \ |
| 22 | date \ |
| 23 | wipe \ |
| 24 | sync \ |
| 25 | umount \ |
| 26 | start \ |
| 27 | stop \ |
| 28 | notify \ |
| 29 | cmp \ |
| 30 | dmesg \ |
| 31 | route \ |
| 32 | hd \ |
| 33 | dd \ |
| 34 | df \ |
| 35 | getprop \ |
| 36 | setprop \ |
| 37 | watchprops \ |
| 38 | log \ |
| 39 | sleep \ |
| 40 | renice \ |
| 41 | printenv \ |
| 42 | smd \ |
| 43 | chmod \ |
Dries Harnie | 2a74373 | 2010-01-18 17:44:33 +0100 | [diff] [blame] | 44 | chown \ |
San Mehat | 72eead4 | 2009-07-06 11:10:03 -0700 | [diff] [blame] | 45 | newfs_msdos \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 46 | netstat \ |
| 47 | ioctl \ |
| 48 | mv \ |
| 49 | schedtop \ |
| 50 | top \ |
| 51 | iftop \ |
| 52 | id \ |
Mike Lockwood | a699d62 | 2010-04-09 15:27:16 -0400 | [diff] [blame] | 53 | uptime \ |
Arve Hjønnevåg | 7c953d0 | 2009-09-17 17:30:55 -0700 | [diff] [blame] | 54 | vmstat \ |
San Mehat | 10d469b | 2010-02-25 14:02:55 -0800 | [diff] [blame] | 55 | nandread \ |
Kenny Root | 8b9b105 | 2010-07-27 09:20:02 -0700 | [diff] [blame] | 56 | ionice \ |
Ken Sumrall | 795165b | 2011-04-05 20:46:30 -0700 | [diff] [blame] | 57 | touch \ |
Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 58 | lsof \ |
| 59 | md5 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 60 | |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 61 | ifeq ($(HAVE_SELINUX),true) |
| 62 | |
| 63 | TOOLS += \ |
| 64 | getenforce \ |
| 65 | setenforce \ |
| 66 | chcon \ |
| 67 | restorecon \ |
| 68 | runcon \ |
| 69 | getsebool \ |
| 70 | setsebool \ |
| 71 | load_policy |
| 72 | |
| 73 | endif |
| 74 | |
| 75 | |
Erik Gilling | b76f0ff | 2011-04-28 14:23:26 -0700 | [diff] [blame] | 76 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 77 | TOOLS += r |
| 78 | endif |
| 79 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 80 | LOCAL_SRC_FILES:= \ |
David 'Digit' Turner | a8d1afb | 2011-01-06 08:39:44 +0100 | [diff] [blame] | 81 | dynarray.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 82 | toolbox.c \ |
| 83 | $(patsubst %,%.c,$(TOOLS)) |
| 84 | |
Mike Lockwood | 1235389 | 2010-12-29 08:33:24 -0500 | [diff] [blame] | 85 | LOCAL_SHARED_LIBRARIES := libcutils libc libusbhost |
Erik Gilling | fd1e855 | 2010-12-09 14:52:53 -0800 | [diff] [blame] | 86 | |
Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 87 | LOCAL_C_INCLUDES := bionic/libc/bionic |
| 88 | |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 89 | ifeq ($(HAVE_SELINUX),true) |
| 90 | |
| 91 | LOCAL_CFLAGS += -DHAVE_SELINUX |
| 92 | LOCAL_SHARED_LIBRARIES += libselinux |
| 93 | LOCAL_C_INCLUDES += external/libselinux/include |
| 94 | |
| 95 | endif |
| 96 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 97 | LOCAL_MODULE:= toolbox |
| 98 | |
| 99 | # Including this will define $(intermediates). |
| 100 | # |
| 101 | include $(BUILD_EXECUTABLE) |
| 102 | |
| 103 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 104 | |
| 105 | TOOLS_H := $(intermediates)/tools.h |
| 106 | $(TOOLS_H): PRIVATE_TOOLS := $(TOOLS) |
| 107 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 108 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 109 | $(TOOLS_H): |
| 110 | $(transform-generated-source) |
| 111 | |
| 112 | # Make #!/system/bin/toolbox launchers for each tool. |
| 113 | # |
| 114 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(TOOLS)) |
| 115 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) |
| 116 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 117 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 118 | @mkdir -p $(dir $@) |
| 119 | @rm -rf $@ |
| 120 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |
| 121 | |
| 122 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 123 | |
| 124 | # We need this so that the installed files could be picked up based on the |
| 125 | # local module name |
| 126 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 127 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |