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 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 \ 44 chown \ 45 newfs_msdos \ 46 netstat \ 47 ioctl \ 48 mv \ 49 schedtop \ 50 top \ 51 iftop \ 52 id \ 53 vmstat 54 55LOCAL_SRC_FILES:= \ 56 toolbox.c \ 57 $(patsubst %,%.c,$(TOOLS)) 58 59LOCAL_SHARED_LIBRARIES := libcutils libc 60 61LOCAL_MODULE:= toolbox 62 63# Including this will define $(intermediates). 64# 65include $(BUILD_EXECUTABLE) 66 67$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h 68 69TOOLS_H := $(intermediates)/tools.h 70$(TOOLS_H): PRIVATE_TOOLS := $(TOOLS) 71$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done 72$(TOOLS_H): $(LOCAL_PATH)/Android.mk 73$(TOOLS_H): 74 $(transform-generated-source) 75 76# Make #!/system/bin/toolbox launchers for each tool. 77# 78SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(TOOLS)) 79$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) 80$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk 81 @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" 82 @mkdir -p $(dir $@) 83 @rm -rf $@ 84 $(hide) ln -sf $(TOOLBOX_BINARY) $@ 85 86ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) 87 88# We need this so that the installed files could be picked up based on the 89# local module name 90ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ 91 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) 92