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 \ |
Kenny Root | 8b9b105 | 2010-07-27 09:20:02 -0700 | [diff] [blame] | 58 | lsof |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 59 | |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 60 | ifeq ($(HAVE_SELINUX),true) |
| 61 | |
| 62 | TOOLS += \ |
| 63 | getenforce \ |
| 64 | setenforce \ |
| 65 | chcon \ |
| 66 | restorecon \ |
| 67 | runcon \ |
| 68 | getsebool \ |
| 69 | setsebool \ |
| 70 | load_policy |
| 71 | |
| 72 | endif |
| 73 | |
| 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 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 79 | LOCAL_SRC_FILES:= \ |
David 'Digit' Turner | a8d1afb | 2011-01-06 08:39:44 +0100 | [diff] [blame] | 80 | dynarray.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 81 | toolbox.c \ |
| 82 | $(patsubst %,%.c,$(TOOLS)) |
| 83 | |
Mike Lockwood | 1235389 | 2010-12-29 08:33:24 -0500 | [diff] [blame] | 84 | LOCAL_SHARED_LIBRARIES := libcutils libc libusbhost |
Erik Gilling | fd1e855 | 2010-12-09 14:52:53 -0800 | [diff] [blame] | 85 | |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 86 | ifeq ($(HAVE_SELINUX),true) |
| 87 | |
| 88 | LOCAL_CFLAGS += -DHAVE_SELINUX |
| 89 | LOCAL_SHARED_LIBRARIES += libselinux |
| 90 | LOCAL_C_INCLUDES += external/libselinux/include |
| 91 | |
| 92 | endif |
| 93 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 94 | LOCAL_MODULE:= toolbox |
| 95 | |
| 96 | # Including this will define $(intermediates). |
| 97 | # |
| 98 | include $(BUILD_EXECUTABLE) |
| 99 | |
| 100 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 101 | |
| 102 | TOOLS_H := $(intermediates)/tools.h |
| 103 | $(TOOLS_H): PRIVATE_TOOLS := $(TOOLS) |
| 104 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 105 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 106 | $(TOOLS_H): |
| 107 | $(transform-generated-source) |
| 108 | |
| 109 | # Make #!/system/bin/toolbox launchers for each tool. |
| 110 | # |
| 111 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(TOOLS)) |
| 112 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) |
| 113 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 114 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 115 | @mkdir -p $(dir $@) |
| 116 | @rm -rf $@ |
| 117 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |
| 118 | |
| 119 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 120 | |
| 121 | # We need this so that the installed files could be picked up based on the |
| 122 | # local module name |
| 123 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 124 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |