Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [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 \ |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 23 | sync \ |
| 24 | umount \ |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 25 | notify \ |
| 26 | cmp \ |
| 27 | dmesg \ |
| 28 | route \ |
| 29 | hd \ |
| 30 | dd \ |
| 31 | df \ |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 32 | sleep \ |
| 33 | renice \ |
| 34 | printenv \ |
| 35 | smd \ |
| 36 | chmod \ |
| 37 | chown \ |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 38 | netstat \ |
| 39 | ioctl \ |
| 40 | mv \ |
| 41 | schedtop \ |
| 42 | top \ |
| 43 | iftop \ |
| 44 | id \ |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 45 | vmstat \ |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 46 | lsof |
| 47 | |
| 48 | LOCAL_SRC_FILES:= \ |
| 49 | toolbox.c \ |
| 50 | $(patsubst %,%.c,$(TOOLS)) |
| 51 | |
| 52 | LOCAL_MODULE:= toolbox |
| 53 | |
| 54 | all: ${LOCAL_MODULE} |
| 55 | |
| 56 | CC ?= gcc |
| 57 | |
| 58 | # Directory where object files should be placed |
| 59 | TARGET_OUT ?= . |
| 60 | |
| 61 | TOOLS_H := ${TARGET_OUT}/tools.h |
| 62 | $(TOOLS_H): |
| 63 | echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 64 | |
| 65 | $(TARGET_OUT)/%.o: %.c |
| 66 | $(CC) $(DEFINES) -I${TARGET_OUT} -c -o $@ $< |
| 67 | |
| 68 | OBJFILES := $(patsubst %.c,$(TARGET_OUT)/%.o,$(LOCAL_SRC_FILES)) |
Denton Gentry | 6b61a3f | 2011-06-12 05:33:33 -0700 | [diff] [blame] | 69 | DEFINES := -DNO_ANDROID_HEADERS |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 70 | |
Denton Gentry | c60b92c | 2011-06-12 05:19:58 -0700 | [diff] [blame] | 71 | toolbox: $(TOOLS_H) $(OBJFILES) |
Denton Gentry | 6b61a3f | 2011-06-12 05:33:33 -0700 | [diff] [blame] | 72 | $(CC) -o $(TARGET_OUT)/$(TARGET) $(DEFINES) $(OBJFILES) $(LIBRARIES) |
Denton Gentry | 1f912cf | 2011-06-12 05:08:41 -0700 | [diff] [blame] | 73 | |
| 74 | # Make #!/system/bin/toolbox launchers for each tool. |
| 75 | # |
| 76 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(TOOLS)) |
| 77 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) |
| 78 | $(SYMLINKS): |
| 79 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 80 | @mkdir -p $(dir $@) |
| 81 | @rm -rf $@ |
| 82 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |