blob: e8e9cef936e1d5f1d488653aa2db2673eda17d94 [file] [log] [blame]
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -08001#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19#
20# To update:
21#
22
23# git remote add toybox https://github.com/gfto/toybox.git
24# git fetch toybox
25# git merge toybox/master
26# mm -j32
27# # (Make any necessary Android.mk changes and test the new toybox.)
28# git push aosp HEAD:master # Push directly, avoiding gerrit.
29# git push aosp HEAD:refs/for/master # Push to gerrit.
30#
31# # Now commit any necessary Android.mk changes like normal:
32# repo start post-sync .
33# git commit -a
34
35
36include $(CLEAR_VARS)
37
38LOCAL_SRC_FILES := \
39 lib/args.c \
40 lib/dirtree.c \
41 lib/getmountlist.c \
42 lib/help.c \
43 lib/lib.c \
44 lib/llist.c \
45 lib/net.c \
46 lib/portability.c \
47 lib/xwrap.c \
48 main.c \
49 toys/lsb/dmesg.c \
50 toys/lsb/hostname.c \
51 toys/lsb/killall.c \
52 toys/lsb/md5sum.c \
53 toys/lsb/mknod.c \
54 toys/lsb/mktemp.c \
55 toys/lsb/mount.c \
56 toys/lsb/pidof.c \
57 toys/lsb/seq.c \
58 toys/lsb/sync.c \
59 toys/lsb/umount.c \
60 toys/other/acpi.c \
Elliott Hughes14862232014-12-18 17:55:47 -080061 toys/other/base64.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080062 toys/other/blkid.c \
63 toys/other/blockdev.c \
64 toys/other/bzcat.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080065 toys/other/chroot.c \
66 toys/other/chvt.c \
67 toys/other/clear.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080068 toys/other/dos2unix.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080069 toys/other/fallocate.c \
70 toys/other/free.c \
71 toys/other/freeramdisk.c \
72 toys/other/fsfreeze.c \
73 toys/other/help.c \
74 toys/other/ifconfig.c \
75 toys/other/inotifyd.c \
76 toys/other/insmod.c \
77 toys/other/losetup.c \
78 toys/other/lsattr.c \
79 toys/other/lsmod.c \
80 toys/other/lspci.c \
81 toys/other/lsusb.c \
82 toys/other/makedevs.c \
83 toys/other/mkswap.c \
84 toys/other/modinfo.c \
85 toys/other/mountpoint.c \
86 toys/other/nbd_client.c \
87 toys/other/netcat.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080088 toys/other/partprobe.c \
89 toys/other/pivot_root.c \
90 toys/other/pmap.c \
91 toys/other/printenv.c \
92 toys/other/pwdx.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080093 toys/other/readlink.c \
94 toys/other/realpath.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080095 toys/other/rev.c \
96 toys/other/rfkill.c \
97 toys/other/rmmod.c \
98 toys/other/setsid.c \
99 toys/other/stat.c \
100 toys/other/swapoff.c \
101 toys/other/swapon.c \
102 toys/other/switch_root.c \
103 toys/other/sysctl.c \
104 toys/other/tac.c \
105 toys/other/taskset.c \
106 toys/other/timeout.c \
107 toys/other/truncate.c \
108 toys/other/unshare.c \
109 toys/other/usleep.c \
110 toys/other/vconfig.c \
111 toys/other/vmstat.c \
112 toys/other/which.c \
113 toys/other/yes.c \
Elliott Hughes76115632014-12-16 09:14:47 -0800114 toys/pending/chcon.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800115 toys/pending/dd.c \
Elliott Hughesf9551b32014-12-24 10:59:08 -0800116 toys/pending/getenforce.c \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800117 toys/pending/more.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800118 toys/pending/ps.c \
119 toys/pending/netstat.c \
120 toys/pending/route.c \
Elliott Hughesf9551b32014-12-24 10:59:08 -0800121 toys/pending/setenforce.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800122 toys/pending/top.c \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800123 toys/pending/tr.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800124 toys/pending/traceroute.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800125 toys/posix/basename.c \
126 toys/posix/cal.c \
127 toys/posix/cat.c \
128 toys/posix/chgrp.c \
129 toys/posix/chmod.c \
130 toys/posix/cksum.c \
131 toys/posix/cmp.c \
132 toys/posix/comm.c \
133 toys/posix/cp.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800134 toys/posix/cut.c \
135 toys/posix/date.c \
136 toys/posix/df.c \
137 toys/posix/dirname.c \
138 toys/posix/du.c \
139 toys/posix/echo.c \
140 toys/posix/env.c \
141 toys/posix/expand.c \
142 toys/posix/false.c \
143 toys/posix/find.c \
144 toys/posix/grep.c \
145 toys/posix/head.c \
146 toys/posix/id.c \
147 toys/posix/kill.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800148 toys/posix/ln.c \
149 toys/posix/ls.c \
150 toys/posix/mkdir.c \
151 toys/posix/mkfifo.c \
152 toys/posix/nice.c \
153 toys/posix/nl.c \
154 toys/posix/nohup.c \
155 toys/posix/od.c \
156 toys/posix/paste.c \
157 toys/posix/patch.c \
158 toys/posix/pwd.c \
159 toys/posix/renice.c \
160 toys/posix/rm.c \
161 toys/posix/rmdir.c \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800162 toys/posix/sed.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800163 toys/posix/sleep.c \
164 toys/posix/sort.c \
165 toys/posix/split.c \
166 toys/posix/strings.c \
167 toys/posix/tail.c \
168 toys/posix/tee.c \
169 toys/posix/time.c \
170 toys/posix/touch.c \
171 toys/posix/true.c \
172 toys/posix/tty.c \
173 toys/posix/uname.c \
174 toys/posix/uniq.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800175 toys/posix/wc.c \
176 toys/posix/xargs.c \
177
178LOCAL_CFLAGS += \
179 -Os \
180 -Wno-char-subscripts \
181 -Wno-sign-compare \
182 -Wno-uninitialized \
183 -Wno-unused-parameter \
184 -funsigned-char -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables \
185
Elliott Hughes76115632014-12-16 09:14:47 -0800186LOCAL_SHARED_LIBRARIES := libselinux
187
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800188LOCAL_MODULE := toybox
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800189
Elliott Hughes6b4d05c2014-12-16 16:15:47 -0800190# dupes: cat chown cmp date df du grep id ifconfig ls
Elliott Hughesdbcacc62014-12-16 19:18:43 -0800191# mount nc netcat notify(inotifyd) renice
Elliott Hughes20800602014-11-25 17:25:05 -0800192# touch umount
Elliott Hughes5f172642014-12-16 21:31:36 -0800193# useless?: chvt freeramdisk fsfreeze install makedevs mkfifo mktemp nbd-client
194# partprobe pivot_root pwdx rev rfkill switch_root tty unshare vconfig
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800195# prefer efs2progs instead?: blkid chattr lsattr
196
197ALL_TOOLS := \
198 acpi \
199 basename \
200 blockdev \
201 bzcat \
202 cal \
Elliott Hughes76115632014-12-16 09:14:47 -0800203 chcon \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800204 chgrp \
Elliott Hughes5c7cca02014-12-11 12:12:59 -0800205 chmod \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800206 chroot \
207 cksum \
Elliott Hughes03275a82014-11-22 22:56:47 -0800208 clear \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800209 comm \
Elliott Hughes6b4d05c2014-12-16 16:15:47 -0800210 cp \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800211 cut \
212 dirname \
Elliott Hughesc99e20b2014-11-26 11:38:43 -0800213 dmesg \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800214 dos2unix \
215 echo \
216 egrep \
217 env \
218 expand \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800219 fallocate \
Elliott Hughes03275a82014-11-22 22:56:47 -0800220 false \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800221 fgrep \
222 find \
223 free \
Elliott Hughes9250c952014-12-24 11:29:44 -0800224 getenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800225 groups \
226 head \
227 hostname \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800228 insmod \
Elliott Hughes95211ea2014-12-04 20:09:44 -0800229 kill \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800230 killall \
231 ln \
232 logname \
233 losetup \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800234 lsmod \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800235 lspci \
236 lsusb \
237 md5sum \
Elliott Hughesd13bf6a2014-12-16 15:17:17 -0800238 mkdir \
Elliott Hughes0a0435c2014-12-11 18:34:09 -0800239 mknod \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800240 mkswap \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800241 modinfo \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800242 more \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800243 mountpoint \
Elliott Hughesdbcacc62014-12-16 19:18:43 -0800244 mv \
Elliott Hughes5f9893b2014-12-23 09:12:18 -0800245 netstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800246 nice \
247 nl \
Elliott Hughes9f989412014-11-25 17:00:40 -0800248 nohup \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800249 od \
250 paste \
251 patch \
252 pidof \
253 pmap \
Elliott Hughes68e18cd2014-11-24 15:36:51 -0800254 printenv \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800255 pwd \
Elliott Hughes8f7bc7a2014-11-26 15:21:03 -0800256 readlink \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800257 realpath \
Elliott Hughesf5275f92014-12-16 16:22:32 -0800258 rm \
Elliott Hughesd4a6d662014-12-16 15:26:53 -0800259 rmdir \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800260 rmmod \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800261 sed \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800262 seq \
Elliott Hughes9250c952014-12-24 11:29:44 -0800263 setenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800264 setsid \
265 sha1sum \
Elliott Hughes62cf8d62014-11-24 15:23:04 -0800266 sleep \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800267 sort \
268 split \
269 stat \
270 strings \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800271 swapoff \
272 swapon \
Elliott Hughes85368282014-11-24 14:53:36 -0800273 sync \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800274 sysctl \
275 tac \
276 tail \
277 taskset \
278 tee \
279 time \
280 timeout \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800281 tr \
Elliott Hughes03275a82014-11-22 22:56:47 -0800282 true \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800283 truncate \
284 uname \
285 uniq \
286 unix2dos \
Elliott Hughes10bd49e2014-11-21 14:53:43 -0800287 usleep \
Elliott Hughes20800602014-11-25 17:25:05 -0800288 vmstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800289 wc \
290 which \
291 whoami \
292 xargs \
293 yes \
294
Ying Wang331b22d2014-11-24 12:42:09 -0800295# Install the symlinks.
296LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800297
Ying Wang331b22d2014-11-24 12:42:09 -0800298include $(BUILD_EXECUTABLE)