1d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
2d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# Copyright (C) 2014 The Android Open Source Project
3d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
4d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# Licensed under the Apache License, Version 2.0 (the "License");
5d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# you may not use this file except in compliance with the License.
6d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# You may obtain a copy of the License at
7d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
8d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#      http://www.apache.org/licenses/LICENSE-2.0
9d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
10d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# Unless required by applicable law or agreed to in writing, software
11d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# distributed under the License is distributed on an "AS IS" BASIS,
12d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# See the License for the specific language governing permissions and
14d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# limitations under the License.
15d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
16d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
17d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott HughesLOCAL_PATH := $(call my-dir)
18d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
19d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
20d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# To update:
21d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
22d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
23a67bfecfec95624d0aa65a4284db23446c2106f9Elliott Hughes#  git remote add toybox https://github.com/landley/toybox.git
24d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  git fetch toybox
25d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  git merge toybox/master
26d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  mm -j32
27d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  # (Make any necessary Android.mk changes and test the new toybox.)
28c7bfbbe771178d205ac446d22dcc87cf1421cb1aElliott Hughes#  repo upload .
29a729fc8373ade0ced1cd0dd5ad43ef6a61a5cd24Elliott Hughes#  git push aosp HEAD:refs/for/master  # Push to gerrit for review.
30d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  git push aosp HEAD:master  # Push directly, avoiding gerrit.
31d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#
32d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  # Now commit any necessary Android.mk changes like normal:
33d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  repo start post-sync .
34d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes#  git commit -a
35d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
36d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
37361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#
38361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes# To add a toy:
39361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#
40361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes
41361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#  make menuconfig
42361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#  # (Select the toy you want to add.)
43361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#  make clean && make  # Regenerate the generated files.
44361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#  # Edit LOCAL_SRC_FILES below to add the toy.
45361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#  # If you just want to use it as "toybox x" rather than "x", you can stop now.
46361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes#  # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS.
47361d6abc4ac4781247106e4694231b3b6971b3fcElliott Hughes
48d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughesinclude $(CLEAR_VARS)
49d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
50d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott HughesLOCAL_SRC_FILES := \
51d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/args.c \
52d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/dirtree.c \
53d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/getmountlist.c \
54d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/help.c \
55584c654efead9619e5a08b387f715882709c3a54Elliott Hughes    lib/interestingtimes.c \
56d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/lib.c \
57a729fc8373ade0ced1cd0dd5ad43ef6a61a5cd24Elliott Hughes    lib/linestack.c \
58d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/llist.c \
59d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/net.c \
60d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/portability.c \
61d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lib/xwrap.c \
62d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    main.c \
630e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    toys/android/getenforce.c \
6485cda1a44a0b00f13a49fd7c606e43cfd1328057Elliott Hughes    toys/android/getprop.c \
650e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    toys/android/load_policy.c \
66e0953ac316d2f9f1fbe9a167d33083873524de3fElliott Hughes    toys/android/restorecon.c \
67cfbb8c14dc7b10e7ece0094b0cead2500661aa72Elliott Hughes    toys/android/runcon.c \
680e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    toys/android/setenforce.c \
694b39d13e8cadb98ca41dcb88303bf5846890fd59Elliott Hughes    toys/android/setprop.c \
70d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/dmesg.c \
71d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/hostname.c \
72d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/killall.c \
73d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/md5sum.c \
74d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/mknod.c \
75d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/mktemp.c \
76d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/mount.c \
77d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/pidof.c \
78d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/seq.c \
79d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/sync.c \
80d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/lsb/umount.c \
81d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/acpi.c \
82148622383ae45985d4b44de5a5dd3674a354e0ccElliott Hughes    toys/other/base64.c \
83d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/blkid.c \
84d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/blockdev.c \
85d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/bzcat.c \
86bf65a2e0c8cf53f35ba0ecb7cedc470d51315d94Elliott Hughes    toys/other/chcon.c \
87d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/chroot.c \
88d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/clear.c \
89d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/dos2unix.c \
90d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/fallocate.c \
910cad3b1b0742168cc6d6c342b566e660d009e5b8Elliott Hughes    toys/other/flock.c \
92d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/free.c \
93d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/freeramdisk.c \
94d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/fsfreeze.c \
95d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/help.c \
96718f34dd95df3d20f2bd955f7fb30d65590e3dddElliott Hughes    toys/other/hwclock.c \
97d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/ifconfig.c \
98d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/inotifyd.c \
99d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/insmod.c \
100e3764ccdc1fc3cde5a679539c58c825ed54293eeElliott Hughes    toys/other/ionice.c \
101d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/losetup.c \
102d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/lsattr.c \
103d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/lsmod.c \
104d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/lsusb.c \
105d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/makedevs.c \
106d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/mkswap.c \
107d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/modinfo.c \
108d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/mountpoint.c \
109d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/nbd_client.c \
110d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/netcat.c \
111d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/partprobe.c \
112d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/pivot_root.c \
113d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/pmap.c \
114d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/printenv.c \
115d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/pwdx.c \
116d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/readlink.c \
117d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/realpath.c \
118d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/rev.c \
119d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/rfkill.c \
120d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/rmmod.c \
121d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/setsid.c \
122d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/stat.c \
123d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/swapoff.c \
124d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/swapon.c \
125d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/switch_root.c \
126d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/sysctl.c \
127d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/tac.c \
128d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/taskset.c \
129d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/timeout.c \
130d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/truncate.c \
13168640611f4181b5b6675e652d49b74ab531c96d9Elliott Hughes    toys/other/uptime.c \
132d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/usleep.c \
133d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/vconfig.c \
134d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/vmstat.c \
135d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/which.c \
136e3764ccdc1fc3cde5a679539c58c825ed54293eeElliott Hughes    toys/other/xxd.c \
137d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/other/yes.c \
1383c3e83a74c613a46c6120e1dc613f57035e1699dElliott Hughes    toys/pending/dd.c \
13988db412ddca32cd2bb7d2c2a5926ef3fbc56e93eElliott Hughes    toys/pending/expr.c \
140ecd3df97a36c0381ec63fca3d0762658e2efa17dElliott Hughes    toys/pending/lsof.c \
14153a43da9b450261eba4490781c734cda29a75b09Elliott Hughes    toys/pending/more.c \
1423c3e83a74c613a46c6120e1dc613f57035e1699dElliott Hughes    toys/pending/netstat.c \
1433c3e83a74c613a46c6120e1dc613f57035e1699dElliott Hughes    toys/pending/route.c \
14488db412ddca32cd2bb7d2c2a5926ef3fbc56e93eElliott Hughes    toys/pending/tar.c \
145347e42b7f7fe968710337ee4343c1412761f31cfElliott Hughes    toys/pending/tr.c \
1463c3e83a74c613a46c6120e1dc613f57035e1699dElliott Hughes    toys/pending/traceroute.c \
147d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/basename.c \
148d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/cal.c \
149d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/cat.c \
150d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/chgrp.c \
151d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/chmod.c \
152d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/cksum.c \
153d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/cmp.c \
154d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/comm.c \
155d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/cp.c \
156bfa8d0633f4c2950d1efb6e65d47614d2c9b2179Elliott Hughes    toys/posix/cpio.c \
157d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/cut.c \
158d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/date.c \
159d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/df.c \
160d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/dirname.c \
161d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/du.c \
162d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/echo.c \
163d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/env.c \
164d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/expand.c \
165d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/false.c \
166d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/find.c \
167d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/grep.c \
168d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/head.c \
169d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/id.c \
170d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/kill.c \
171d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/ln.c \
172d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/ls.c \
173d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/mkdir.c \
174d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/mkfifo.c \
175d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/nice.c \
176d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/nl.c \
177d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/nohup.c \
178d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/od.c \
179d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/paste.c \
180d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/patch.c \
1810e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    toys/posix/printf.c \
182b131803047c2a5601b9dc7ea6b09934540b51cc0Elliott Hughes    toys/posix/ps.c \
183d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/pwd.c \
184d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/renice.c \
185d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/rm.c \
186d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/rmdir.c \
187347e42b7f7fe968710337ee4343c1412761f31cfElliott Hughes    toys/posix/sed.c \
188d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/sleep.c \
189d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/sort.c \
190d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/split.c \
191d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/strings.c \
192d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/tail.c \
193d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/tee.c \
194d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/time.c \
195d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/touch.c \
196d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/true.c \
197d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/tty.c \
19859224354ca99b704cec9c2280689949cf2f6b3c8Elliott Hughes    toys/posix/ulimit.c \
199d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/uname.c \
200d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/uniq.c \
201d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/wc.c \
202d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    toys/posix/xargs.c \
203d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
204d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott HughesLOCAL_CFLAGS += \
2054b39d13e8cadb98ca41dcb88303bf5846890fd59Elliott Hughes    -std=c99 \
206d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    -Os \
207d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    -Wno-char-subscripts \
208d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    -Wno-sign-compare \
2090e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    -Wno-string-plus-int \
210d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    -Wno-uninitialized \
211d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    -Wno-unused-parameter \
212d353398914d251e9dd2e84a3bbe61ba3a834b511Elliott Hughes    -funsigned-char \
213d353398914d251e9dd2e84a3bbe61ba3a834b511Elliott Hughes    -ffunction-sections -fdata-sections \
214d353398914d251e9dd2e84a3bbe61ba3a834b511Elliott Hughes    -fno-asynchronous-unwind-tables \
215d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
21635c9c63120a40f4cfe119f5670d914ac5e69c0f6Elliott Hughestoybox_upstream_version := $(shell awk 'match($$0, /TOYBOX_VERSION.*"(.*)"/, ary) {print ary[1]}' $(LOCAL_PATH)/main.c)
21735c9c63120a40f4cfe119f5670d914ac5e69c0f6Elliott Hughestoybox_sha := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)
21835c9c63120a40f4cfe119f5670d914ac5e69c0f6Elliott Hughes
21935c9c63120a40f4cfe119f5670d914ac5e69c0f6Elliott Hughestoybox_version := $(toybox_upstream_version)-$(toybox_sha)-android
220ec275a9a59a986b927788cc0d8a4c4aad3e6e4a0Elliott HughesLOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
221ec275a9a59a986b927788cc0d8a4c4aad3e6e4a0Elliott Hughes
2224b39d13e8cadb98ca41dcb88303bf5846890fd59Elliott HughesLOCAL_CLANG := true
2234b39d13e8cadb98ca41dcb88303bf5846890fd59Elliott Hughes
2244b39d13e8cadb98ca41dcb88303bf5846890fd59Elliott HughesLOCAL_SHARED_LIBRARIES := libcutils libselinux
225761156322f0c7d57a5860daf6b582b78a1d8c993Elliott Hughes
22618ed9c765096a1a9b993b29df74749f7e811315aElliott Hughes# This doesn't actually prevent us from dragging in libc++ at runtime
22718ed9c765096a1a9b993b29df74749f7e811315aElliott Hughes# because libnetd_client.so is C++.
22818ed9c765096a1a9b993b29df74749f7e811315aElliott HughesLOCAL_CXX_STL := none
22918ed9c765096a1a9b993b29df74749f7e811315aElliott Hughes
230d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott HughesLOCAL_MODULE := toybox
231d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
232578e62806af81c858150d5fa45842781e1b35911Elliott Hughes# dupes: dd
233d67730eb9ae4f387fc2d50a8210e789b1509288eElliott Hughes# useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
2344dc6296a022d2d100233806a0586a03d6fde1a8dElliott Hughes#           partprobe pivot_root pwdx rev rfkill switch_root vconfig
2355eec03a13b5218715922f778f27e6e9596b7c244Elliott Hughes# prefer BSD netcat instead?: nc netcat
236d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes# prefer efs2progs instead?: blkid chattr lsattr
237d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
238d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott HughesALL_TOOLS := \
239d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    acpi \
240184651300d6a9a2f5dd00ba9945c9c52af23962cElliott Hughes    base64 \
241d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    basename \
242d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    blockdev \
243d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    bzcat \
244d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    cal \
2451e0e5eab47a186b53d225727c4f2ed3f5e68f2d7Elliott Hughes    cat \
246761156322f0c7d57a5860daf6b582b78a1d8c993Elliott Hughes    chcon \
247d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    chgrp \
2485c7cca028966933d5d18b4de5c961b816ad5b3dfElliott Hughes    chmod \
2496ee70fc004112d422e7b2fb8706df9b385c88e30Elliott Hughes    chown \
250d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    chroot \
251d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    cksum \
25203275a865cd0481a74d09951295455c6e706e085Elliott Hughes    clear \
253d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    comm \
254d353398914d251e9dd2e84a3bbe61ba3a834b511Elliott Hughes    cmp \
2556b4d05c1dccaef7415dd17ae939e291b3f85cc50Elliott Hughes    cp \
256bfa8d0633f4c2950d1efb6e65d47614d2c9b2179Elliott Hughes    cpio \
257d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    cut \
2589aaeff3e0283196b4ed3eaf6ced0f4b224ac24e2Elliott Hughes    date \
259578e62806af81c858150d5fa45842781e1b35911Elliott Hughes    df \
260d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    dirname \
261c99e20b967d0786c330310bec95715db76b6e2e2Elliott Hughes    dmesg \
262d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    dos2unix \
2634dc6296a022d2d100233806a0586a03d6fde1a8dElliott Hughes    du \
264d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    echo \
265d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    env \
266d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    expand \
26788db412ddca32cd2bb7d2c2a5926ef3fbc56e93eElliott Hughes    expr \
268d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    fallocate \
26903275a865cd0481a74d09951295455c6e706e085Elliott Hughes    false \
270d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    find \
2710cad3b1b0742168cc6d6c342b566e660d009e5b8Elliott Hughes    flock \
272d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    free \
2739250c95a8c471981e2ba1aedb401a75f42e1293bElliott Hughes    getenforce \
27485cda1a44a0b00f13a49fd7c606e43cfd1328057Elliott Hughes    getprop \
275d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    groups \
276d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    head \
277d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    hostname \
2789aaeff3e0283196b4ed3eaf6ced0f4b224ac24e2Elliott Hughes    hwclock \
279c8fa5ee959bc35d728e8ff39f84abb085c92d235Elliott Hughes    id \
2804f060a32b287fbb945e55b4a83d311eafde2764dElliott Hughes    ifconfig \
281123aecf242ba8d732653904e7fe256bd58d4677fElliott Hughes    inotifyd \
2826a646ef606d959342614cd7a54aa44b1d592f596Elliott Hughes    insmod \
283a53c8ff768641f5d511b18bdb46b9776926308d7Elliott Hughes    ionice \
284a53c8ff768641f5d511b18bdb46b9776926308d7Elliott Hughes    iorenice \
28595211ea79a02f3b40bcfcb0e65056e65894121e2Elliott Hughes    kill \
28653a1aa3253868a124ca7c1b6e0542f7154108b16Josh Gao    killall \
2870e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    load_policy \
288d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    ln \
289d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    logname \
290d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    losetup \
2912e72007ecb54ff47d7d637a61baacf256513d021Elliott Hughes    ls \
2926a646ef606d959342614cd7a54aa44b1d592f596Elliott Hughes    lsmod \
29377538439679e8592f5cba6ba3c1dffd3e470255bElliott Hughes    lsof \
294d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    lsusb \
295d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    md5sum \
296d13bf6a7b53157c721bd381cc6e0b5c2ab30119cElliott Hughes    mkdir \
2970a0435c394fead623eac1495d1c4148d92bd4ae1Elliott Hughes    mknod \
298620bc1a345c5f8ce4ef2e58599199a7361590d28Elliott Hughes    mkswap \
29979984b400ef6bcec74d1599c8a2f71f65ff1441eElliott Hughes    mktemp \
300d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    modinfo \
30153a43da9b450261eba4490781c734cda29a75b09Elliott Hughes    more \
3020e7e9a15726650e492b09f51a48ef14a7e1b0c2eElliott Hughes    mount \
303d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    mountpoint \
304dbcacc6f01ed3c4a7eafc0ef34db4e7b35cdd2cdElliott Hughes    mv \
3055f9893b6b218710ba22fbdd3e0adc51e644b369aElliott Hughes    netstat \
306d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    nice \
307d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    nl \
3089f9894131c5914ed75a02f839c1698f654940ca6Elliott Hughes    nohup \
309d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    od \
310d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    paste \
311d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    patch \
3125d2ad2398b7cc6ab6f761c9900e46efe163c1521Elliott Hughes    pgrep \
313d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    pidof \
3145d2ad2398b7cc6ab6f761c9900e46efe163c1521Elliott Hughes    pkill \
315d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    pmap \
31668e18cd5aa4a3a319a4b3b5f23384c6841f54067Elliott Hughes    printenv \
3170e6551acb8c8c19592896a260f0b873c88df2646Elliott Hughes    printf \
318d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    pwd \
3198f7bc7a63b419318928c66ed936b828607ab8668Elliott Hughes    readlink \
320d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    realpath \
321a53c8ff768641f5d511b18bdb46b9776926308d7Elliott Hughes    renice \
322e0953ac316d2f9f1fbe9a167d33083873524de3fElliott Hughes    restorecon \
323f5275f9e2b9bd2d5fd95a17e0c1165503193985dElliott Hughes    rm \
324d4a6d66e84b5c47bdd5ac53b55a559191f2300d9Elliott Hughes    rmdir \
3256a646ef606d959342614cd7a54aa44b1d592f596Elliott Hughes    rmmod \
32684974ece9439dc5091c9502c68211649a79ada36Elliott Hughes    route \
327cfbb8c14dc7b10e7ece0094b0cead2500661aa72Elliott Hughes    runcon \
328347e42b7f7fe968710337ee4343c1412761f31cfElliott Hughes    sed \
329d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    seq \
3309250c95a8c471981e2ba1aedb401a75f42e1293bElliott Hughes    setenforce \
331176eae9c391bf381c675260062d6aa78cb5c22ceElliott Hughes    setprop \
332d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    setsid \
333d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    sha1sum \
33462cf8d653994ffae64d39873eb5d6e0901a1c9b5Elliott Hughes    sleep \
335d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    sort \
336d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    split \
337d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    stat \
338d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    strings \
339620bc1a345c5f8ce4ef2e58599199a7361590d28Elliott Hughes    swapoff \
340620bc1a345c5f8ce4ef2e58599199a7361590d28Elliott Hughes    swapon \
34185368288de25655a3c3ee065238c652d702e091aElliott Hughes    sync \
342d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    sysctl \
343d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    tac \
344d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    tail \
34588db412ddca32cd2bb7d2c2a5926ef3fbc56e93eElliott Hughes    tar \
346d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    taskset \
347d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    tee \
348d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    time \
349d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    timeout \
3505eec03a13b5218715922f778f27e6e9596b7c244Elliott Hughes    touch \
351347e42b7f7fe968710337ee4343c1412761f31cfElliott Hughes    tr \
35203275a865cd0481a74d09951295455c6e706e085Elliott Hughes    true \
353d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    truncate \
3546f52fbcc814f574517cd9a4516f6b9fe45f1afbaElliott Hughes    tty \
35559224354ca99b704cec9c2280689949cf2f6b3c8Elliott Hughes    ulimit \
356cc6fc1742d903ec4da7688a6b3d0215343e4609cElliott Hughes    umount \
357d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    uname \
358d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    uniq \
359d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    unix2dos \
36068640611f4181b5b6675e652d49b74ab531c96d9Elliott Hughes    uptime \
36110bd49ec5e24231eb94746e601349f1d5a3c0658Elliott Hughes    usleep \
3622080060f8e4a053b13bc11b44928a85f48172ec5Elliott Hughes    vmstat \
363d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    wc \
364d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    which \
365d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    whoami \
366d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    xargs \
367dce8d6242dbd3998f7aaff745d1125399853ebcaElliott Hughes    xxd \
368d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes    yes \
369d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
370331b22de00b1dd749169f84ccf92c77f0036dfc8Ying Wang# Install the symlinks.
371331b22de00b1dd749169f84ccf92c77f0036dfc8Ying WangLOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
372d8d2d3c44e552f4e53708db5ea60a7f91a382c0fElliott Hughes
373331b22de00b1dd749169f84ccf92c77f0036dfc8Ying Wanginclude $(BUILD_EXECUTABLE)
374