blob: 93492764b65ed4002d3b910abe7f85ed0c63f6fd [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001LOCAL_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 \
San Mehat72eead42009-07-06 11:10:03 -070045 newfs_msdos \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080046 netstat \
47 ioctl \
48 mv \
49 schedtop \
50 top \
51 iftop \
52 id \
Mike Lockwooda699d622010-04-09 15:27:16 -040053 uptime \
Arve Hjønnevåg7c953d02009-09-17 17:30:55 -070054 vmstat \
San Mehat10d469b2010-02-25 14:02:55 -080055 nandread \
Mike Lockwood5ffbf262010-04-09 15:27:16 -040056 ionice
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080057
58LOCAL_SRC_FILES:= \
59 toolbox.c \
60 $(patsubst %,%.c,$(TOOLS))
61
62LOCAL_SHARED_LIBRARIES := libcutils libc
63
64LOCAL_MODULE:= toolbox
65
66# Including this will define $(intermediates).
67#
68include $(BUILD_EXECUTABLE)
69
70$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
71
72TOOLS_H := $(intermediates)/tools.h
73$(TOOLS_H): PRIVATE_TOOLS := $(TOOLS)
74$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
75$(TOOLS_H): $(LOCAL_PATH)/Android.mk
76$(TOOLS_H):
77 $(transform-generated-source)
78
79# Make #!/system/bin/toolbox launchers for each tool.
80#
81SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(TOOLS))
82$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE)
83$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
84 @echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
85 @mkdir -p $(dir $@)
86 @rm -rf $@
87 $(hide) ln -sf $(TOOLBOX_BINARY) $@
88
89ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
90
91# We need this so that the installed files could be picked up based on the
92# local module name
93ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
94 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)