# To update:
#
-# git remote add toybox https://github.com/gfto/toybox.git
+# git remote add toybox https://github.com/landley/toybox.git
# git fetch toybox
# git merge toybox/master
# mm -j32
# git commit -a
+#
+# To add a toy:
+#
+
+# make menuconfig
+# # (Select the toy you want to add.)
+# make clean && make # Regenerate the generated files.
+# # Edit LOCAL_SRC_FILES below to add the toy.
+# # If you just want to use it as "toybox x" rather than "x", you can stop now.
+# # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS.
+
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
lib/dirtree.c \
lib/getmountlist.c \
lib/help.c \
+ lib/interestingtimes.c \
lib/lib.c \
lib/llist.c \
lib/net.c \
lib/portability.c \
lib/xwrap.c \
main.c \
+ toys/android/getenforce.c \
+ toys/android/getprop.c \
+ toys/android/load_policy.c \
+ toys/android/restorecon.c \
+ toys/android/runcon.c \
+ toys/android/setenforce.c \
+ toys/android/setprop.c \
toys/lsb/dmesg.c \
toys/lsb/hostname.c \
toys/lsb/killall.c \
toys/other/blkid.c \
toys/other/blockdev.c \
toys/other/bzcat.c \
+ toys/other/chcon.c \
toys/other/chroot.c \
- toys/other/chvt.c \
toys/other/clear.c \
toys/other/dos2unix.c \
toys/other/fallocate.c \
toys/other/freeramdisk.c \
toys/other/fsfreeze.c \
toys/other/help.c \
+ toys/other/hwclock.c \
toys/other/ifconfig.c \
toys/other/inotifyd.c \
toys/other/insmod.c \
+ toys/other/ionice.c \
toys/other/losetup.c \
toys/other/lsattr.c \
toys/other/lsmod.c \
- toys/other/lspci.c \
toys/other/lsusb.c \
toys/other/makedevs.c \
toys/other/mkswap.c \
toys/other/taskset.c \
toys/other/timeout.c \
toys/other/truncate.c \
- toys/other/unshare.c \
toys/other/usleep.c \
toys/other/vconfig.c \
toys/other/vmstat.c \
toys/other/which.c \
+ toys/other/xxd.c \
toys/other/yes.c \
- toys/pending/chcon.c \
toys/pending/dd.c \
- toys/pending/getenforce.c \
- toys/pending/hwclock.c \
+ toys/pending/expr.c \
toys/pending/more.c \
- toys/pending/ps.c \
+ toys/pending/pgrep.c \
toys/pending/netstat.c \
toys/pending/route.c \
- toys/pending/setenforce.c \
+ toys/pending/tar.c \
toys/pending/top.c \
toys/pending/tr.c \
toys/pending/traceroute.c \
toys/posix/cmp.c \
toys/posix/comm.c \
toys/posix/cp.c \
+ toys/posix/cpio.c \
toys/posix/cut.c \
toys/posix/date.c \
toys/posix/df.c \
toys/posix/od.c \
toys/posix/paste.c \
toys/posix/patch.c \
+ toys/posix/printf.c \
toys/posix/pwd.c \
toys/posix/renice.c \
toys/posix/rm.c \
toys/posix/xargs.c \
LOCAL_CFLAGS += \
+ -std=c99 \
-Os \
-Wno-char-subscripts \
-Wno-sign-compare \
+ -Wno-string-plus-int \
-Wno-uninitialized \
-Wno-unused-parameter \
-funsigned-char \
-ffunction-sections -fdata-sections \
-fno-asynchronous-unwind-tables \
-LOCAL_SHARED_LIBRARIES := libselinux
+toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
+LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
+
+LOCAL_CLANG := true
+
+LOCAL_SHARED_LIBRARIES := libcutils libselinux
+
+# This doesn't actually prevent us from dragging in libc++ at runtime
+# because libnetd_client.so is C++.
+LOCAL_CXX_STL := none
LOCAL_MODULE := toybox
-# dupes: df du ls mount nc netcat renice touch umount
-# useless?: chvt freeramdisk fsfreeze install makedevs mkfifo mktemp nbd-client
-# partprobe pivot_root pwdx rev rfkill switch_root tty unshare vconfig
+# dupes: dd df du ls
+# useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
+# partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
+# prefer BSD netcat instead?: nc netcat
# prefer efs2progs instead?: blkid chattr lsattr
ALL_TOOLS := \
comm \
cmp \
cp \
+ cpio \
cut \
date \
dirname \
echo \
env \
expand \
+ expr \
fallocate \
false \
find \
free \
getenforce \
+ getprop \
groups \
head \
hostname \
ifconfig \
inotifyd \
insmod \
+ ionice \
+ iorenice \
kill \
- killall \
+ load_policy \
ln \
logname \
losetup \
lsmod \
- lspci \
lsusb \
md5sum \
mkdir \
mknod \
mkswap \
+ mktemp \
modinfo \
more \
+ mount \
mountpoint \
mv \
netstat \
od \
paste \
patch \
+ pgrep \
pidof \
+ pkill \
pmap \
printenv \
+ printf \
pwd \
readlink \
realpath \
+ renice \
+ restorecon \
rm \
rmdir \
rmmod \
+ route \
+ runcon \
sed \
seq \
setenforce \
+ setprop \
setsid \
sha1sum \
sleep \
sysctl \
tac \
tail \
+ tar \
taskset \
tee \
time \
timeout \
+ touch \
tr \
true \
truncate \
+ tty \
+ umount \
uname \
uniq \
unix2dos \
which \
whoami \
xargs \
+ xxd \
yes \
# Install the symlinks.