blob: 37870785b2b3d30a03220eacafcc96a6900628ad [file] [log] [blame]
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
TOOLS := \
ls \
mount \
cat \
ps \
kill \
ln \
insmod \
rmmod \
lsmod \
ifconfig \
setconsole \
rm \
mkdir \
rmdir \
reboot \
getevent \
sendevent \
date \
sync \
umount \
notify \
cmp \
dmesg \
route \
hd \
dd \
df \
sleep \
renice \
printenv \
smd \
chmod \
chown \
netstat \
ioctl \
mv \
schedtop \
top \
iftop \
id \
uptime \
vmstat \
nandread \
ionice \
lsof
LOCAL_SRC_FILES:= \
toolbox.c \
$(patsubst %,%.c,$(TOOLS))
LOCAL_MODULE:= toolbox
all: ${LOCAL_MODULE}
CC ?= gcc
# Directory where object files should be placed
TARGET_OUT ?= .
TOOLS_H := ${TARGET_OUT}/tools.h
$(TOOLS_H):
echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
$(TARGET_OUT)/%.o: %.c
$(CC) $(DEFINES) -I${TARGET_OUT} -c -o $@ $<
OBJFILES := $(patsubst %.c,$(TARGET_OUT)/%.o,$(LOCAL_SRC_FILES))
DEFINES := -DNO_ANDROID_HEADERS
toolbox: $(TOOLS_H) $(OBJFILES)
$(CC) -o $(TARGET_OUT)/$(TARGET) $(DEFINES) $(OBJFILES) $(LIBRARIES)
# Make #!/system/bin/toolbox launchers for each tool.
#
SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(TOOLS))
$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE)
$(SYMLINKS):
@echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf $(TOOLBOX_BINARY) $@