OSDN Git Service

am a53c8ff7: Switch to toybox ionice, iorenice, and renice.
[android-x86/external-toybox.git] / Android.mk
index 750d704..15962d6 100644 (file)
@@ -20,7 +20,7 @@ LOCAL_PATH := $(call my-dir)
 # 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
@@ -33,6 +33,17 @@ LOCAL_PATH := $(call my-dir)
 #  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 := \
@@ -40,12 +51,20 @@ 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 \
@@ -62,8 +81,8 @@ LOCAL_SRC_FILES := \
     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 \
@@ -71,13 +90,14 @@ LOCAL_SRC_FILES := \
     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 \
@@ -105,21 +125,19 @@ LOCAL_SRC_FILES := \
     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 \
@@ -132,6 +150,7 @@ LOCAL_SRC_FILES := \
     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 \
@@ -156,6 +175,7 @@ LOCAL_SRC_FILES := \
     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 \
@@ -177,22 +197,34 @@ LOCAL_SRC_FILES := \
     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 := \
@@ -212,6 +244,7 @@ ALL_TOOLS := \
     comm \
     cmp \
     cp \
+    cpio \
     cut \
     date \
     dirname \
@@ -220,11 +253,13 @@ ALL_TOOLS := \
     echo \
     env \
     expand \
+    expr \
     fallocate \
     false \
     find \
     free \
     getenforce \
+    getprop \
     groups \
     head \
     hostname \
@@ -233,20 +268,23 @@ ALL_TOOLS := \
     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 \
@@ -256,18 +294,26 @@ ALL_TOOLS := \
     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 \
@@ -281,13 +327,17 @@ ALL_TOOLS := \
     sysctl \
     tac \
     tail \
+    tar \
     taskset \
     tee \
     time \
     timeout \
+    touch \
     tr \
     true \
     truncate \
+    tty \
+    umount \
     uname \
     uniq \
     unix2dos \
@@ -297,6 +347,7 @@ ALL_TOOLS := \
     which \
     whoami \
     xargs \
+    xxd \
     yes \
 
 # Install the symlinks.