Android.mk revision 3707e7ff03a4240c8603f2d2e1d0b69fe7994cb9
1LOCAL_PATH:= $(call my-dir) 2include $(CLEAR_VARS) 3 4TOOLS := \ 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 getevent \ 20 sendevent \ 21 date \ 22 wipe \ 23 sync \ 24 umount \ 25 start \ 26 stop \ 27 notify \ 28 cmp \ 29 dmesg \ 30 route \ 31 hd \ 32 dd \ 33 df \ 34 getprop \ 35 setprop \ 36 watchprops \ 37 log \ 38 sleep \ 39 renice \ 40 printenv \ 41 smd \ 42 chmod \ 43 chown \ 44 newfs_msdos \ 45 netstat \ 46 ioctl \ 47 mv \ 48 schedtop \ 49 top \ 50 iftop \ 51 id \ 52 uptime \ 53 vmstat \ 54 nandread \ 55 ionice \ 56 touch \ 57 lsof \ 58 du \ 59 md5 \ 60 clear \ 61 getenforce \ 62 setenforce \ 63 chcon \ 64 restorecon \ 65 runcon \ 66 getsebool \ 67 setsebool \ 68 load_policy \ 69 swapon \ 70 swapoff \ 71 mkswap \ 72 readlink \ 73 nohup 74 75ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 76TOOLS += r 77endif 78 79ALL_TOOLS = $(TOOLS) 80ALL_TOOLS += \ 81 cp \ 82 grep 83 84LOCAL_SRC_FILES := \ 85 dynarray.c \ 86 toolbox.c \ 87 $(patsubst %,%.c,$(TOOLS)) \ 88 cp/cp.c cp/utils.c \ 89 grep/grep.c grep/fastgrep.c grep/file.c grep/queue.c grep/util.c 90 91LOCAL_C_INCLUDES := bionic/libc/bionic 92 93LOCAL_SHARED_LIBRARIES := \ 94 libcutils \ 95 liblog \ 96 libc \ 97 libusbhost \ 98 libselinux 99 100LOCAL_MODULE := toolbox 101 102# Including this will define $(intermediates). 103# 104include $(BUILD_EXECUTABLE) 105 106$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h 107 108TOOLS_H := $(intermediates)/tools.h 109$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) 110$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done 111$(TOOLS_H): $(LOCAL_PATH)/Android.mk 112$(TOOLS_H): 113 $(transform-generated-source) 114 115# Make #!/system/bin/toolbox launchers for each tool. 116# 117SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS)) 118$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) 119$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk 120 @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" 121 @mkdir -p $(dir $@) 122 @rm -rf $@ 123 $(hide) ln -sf $(TOOLBOX_BINARY) $@ 124 125ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) 126 127# We need this so that the installed files could be picked up based on the 128# local module name 129ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ 130 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) 131