blob: c89c823ae40380af2889ec300a50702f479788c0 [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 Hughesbf65a2e2015-02-09 12:14:46 -080065 toys/other/chcon.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080066 toys/other/chroot.c \
67 toys/other/chvt.c \
68 toys/other/clear.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080069 toys/other/dos2unix.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080070 toys/other/fallocate.c \
71 toys/other/free.c \
72 toys/other/freeramdisk.c \
73 toys/other/fsfreeze.c \
74 toys/other/help.c \
75 toys/other/ifconfig.c \
76 toys/other/inotifyd.c \
77 toys/other/insmod.c \
78 toys/other/losetup.c \
79 toys/other/lsattr.c \
80 toys/other/lsmod.c \
81 toys/other/lspci.c \
82 toys/other/lsusb.c \
83 toys/other/makedevs.c \
84 toys/other/mkswap.c \
85 toys/other/modinfo.c \
86 toys/other/mountpoint.c \
87 toys/other/nbd_client.c \
88 toys/other/netcat.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080089 toys/other/partprobe.c \
90 toys/other/pivot_root.c \
91 toys/other/pmap.c \
92 toys/other/printenv.c \
93 toys/other/pwdx.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080094 toys/other/readlink.c \
95 toys/other/realpath.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080096 toys/other/rev.c \
97 toys/other/rfkill.c \
98 toys/other/rmmod.c \
99 toys/other/setsid.c \
100 toys/other/stat.c \
101 toys/other/swapoff.c \
102 toys/other/swapon.c \
103 toys/other/switch_root.c \
104 toys/other/sysctl.c \
105 toys/other/tac.c \
106 toys/other/taskset.c \
107 toys/other/timeout.c \
108 toys/other/truncate.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800109 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 Hughes3c3e83a2014-12-16 20:18:05 -0800114 toys/pending/dd.c \
Elliott Hughesf9551b32014-12-24 10:59:08 -0800115 toys/pending/getenforce.c \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800116 toys/pending/hwclock.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 Hughesbfa8d062015-02-05 10:02:55 -0800134 toys/posix/cpio.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800135 toys/posix/cut.c \
136 toys/posix/date.c \
137 toys/posix/df.c \
138 toys/posix/dirname.c \
139 toys/posix/du.c \
140 toys/posix/echo.c \
141 toys/posix/env.c \
142 toys/posix/expand.c \
143 toys/posix/false.c \
144 toys/posix/find.c \
145 toys/posix/grep.c \
146 toys/posix/head.c \
147 toys/posix/id.c \
148 toys/posix/kill.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800149 toys/posix/ln.c \
150 toys/posix/ls.c \
151 toys/posix/mkdir.c \
152 toys/posix/mkfifo.c \
153 toys/posix/nice.c \
154 toys/posix/nl.c \
155 toys/posix/nohup.c \
156 toys/posix/od.c \
157 toys/posix/paste.c \
158 toys/posix/patch.c \
159 toys/posix/pwd.c \
160 toys/posix/renice.c \
161 toys/posix/rm.c \
162 toys/posix/rmdir.c \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800163 toys/posix/sed.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800164 toys/posix/sleep.c \
165 toys/posix/sort.c \
166 toys/posix/split.c \
167 toys/posix/strings.c \
168 toys/posix/tail.c \
169 toys/posix/tee.c \
170 toys/posix/time.c \
171 toys/posix/touch.c \
172 toys/posix/true.c \
173 toys/posix/tty.c \
174 toys/posix/uname.c \
175 toys/posix/uniq.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800176 toys/posix/wc.c \
177 toys/posix/xargs.c \
178
179LOCAL_CFLAGS += \
180 -Os \
181 -Wno-char-subscripts \
182 -Wno-sign-compare \
183 -Wno-uninitialized \
184 -Wno-unused-parameter \
Elliott Hughesd3533982015-01-15 15:04:19 -0800185 -funsigned-char \
186 -ffunction-sections -fdata-sections \
187 -fno-asynchronous-unwind-tables \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800188
Elliott Hughes76115632014-12-16 09:14:47 -0800189LOCAL_SHARED_LIBRARIES := libselinux
190
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800191LOCAL_MODULE := toybox
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800192
Elliott Hughes5eec03a2015-02-09 14:09:49 -0800193# dupes: dd df du ls mount renice umount
Elliott Hughes79984b42015-02-09 12:16:39 -0800194# useless?: chvt freeramdisk fsfreeze install makedevs mkfifo nbd-client
Elliott Hughesbf65a2e2015-02-09 12:14:46 -0800195# partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
Elliott Hughes5eec03a2015-02-09 14:09:49 -0800196# prefer BSD netcat instead?: nc netcat
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800197# prefer efs2progs instead?: blkid chattr lsattr
198
199ALL_TOOLS := \
200 acpi \
201 basename \
202 blockdev \
203 bzcat \
204 cal \
Elliott Hughes1e0e5ea2015-01-14 10:40:22 -0800205 cat \
Elliott Hughes76115632014-12-16 09:14:47 -0800206 chcon \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800207 chgrp \
Elliott Hughes5c7cca02014-12-11 12:12:59 -0800208 chmod \
Elliott Hughes6ee70fc2015-01-15 13:41:34 -0800209 chown \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800210 chroot \
211 cksum \
Elliott Hughes03275a82014-11-22 22:56:47 -0800212 clear \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800213 comm \
Elliott Hughesd3533982015-01-15 15:04:19 -0800214 cmp \
Elliott Hughes6b4d05c2014-12-16 16:15:47 -0800215 cp \
Elliott Hughesbfa8d062015-02-05 10:02:55 -0800216 cpio \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800217 cut \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800218 date \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800219 dirname \
Elliott Hughesc99e20b2014-11-26 11:38:43 -0800220 dmesg \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800221 dos2unix \
222 echo \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800223 env \
224 expand \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800225 fallocate \
Elliott Hughes03275a82014-11-22 22:56:47 -0800226 false \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800227 find \
228 free \
Elliott Hughes9250c952014-12-24 11:29:44 -0800229 getenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800230 groups \
231 head \
232 hostname \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800233 hwclock \
Elliott Hughesc8fa5ee2015-01-16 19:27:31 -0800234 id \
Elliott Hughes4f060a32015-01-14 11:07:28 -0800235 ifconfig \
Elliott Hughes123aecf2015-01-14 11:00:47 -0800236 inotifyd \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800237 insmod \
Elliott Hughes95211ea2014-12-04 20:09:44 -0800238 kill \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800239 killall \
240 ln \
241 logname \
242 losetup \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800243 lsmod \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800244 lspci \
245 lsusb \
246 md5sum \
Elliott Hughesd13bf6a2014-12-16 15:17:17 -0800247 mkdir \
Elliott Hughes0a0435c2014-12-11 18:34:09 -0800248 mknod \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800249 mkswap \
Elliott Hughes79984b42015-02-09 12:16:39 -0800250 mktemp \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800251 modinfo \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800252 more \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800253 mountpoint \
Elliott Hughesdbcacc62014-12-16 19:18:43 -0800254 mv \
Elliott Hughes5f9893b2014-12-23 09:12:18 -0800255 netstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800256 nice \
257 nl \
Elliott Hughes9f989412014-11-25 17:00:40 -0800258 nohup \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800259 od \
260 paste \
261 patch \
262 pidof \
263 pmap \
Elliott Hughes68e18cd2014-11-24 15:36:51 -0800264 printenv \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800265 pwd \
Elliott Hughes8f7bc7a2014-11-26 15:21:03 -0800266 readlink \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800267 realpath \
Elliott Hughesf5275f92014-12-16 16:22:32 -0800268 rm \
Elliott Hughesd4a6d662014-12-16 15:26:53 -0800269 rmdir \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800270 rmmod \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800271 sed \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800272 seq \
Elliott Hughes9250c952014-12-24 11:29:44 -0800273 setenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800274 setsid \
275 sha1sum \
Elliott Hughes62cf8d62014-11-24 15:23:04 -0800276 sleep \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800277 sort \
278 split \
279 stat \
280 strings \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800281 swapoff \
282 swapon \
Elliott Hughes85368282014-11-24 14:53:36 -0800283 sync \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800284 sysctl \
285 tac \
286 tail \
287 taskset \
288 tee \
289 time \
290 timeout \
Elliott Hughes5eec03a2015-02-09 14:09:49 -0800291 touch \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800292 tr \
Elliott Hughes03275a82014-11-22 22:56:47 -0800293 true \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800294 truncate \
295 uname \
296 uniq \
297 unix2dos \
Elliott Hughes10bd49e2014-11-21 14:53:43 -0800298 usleep \
Elliott Hughes20800602014-11-25 17:25:05 -0800299 vmstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800300 wc \
301 which \
302 whoami \
303 xargs \
304 yes \
305
Ying Wang331b22d2014-11-24 12:42:09 -0800306# Install the symlinks.
307LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800308
Ying Wang331b22d2014-11-24 12:42:09 -0800309include $(BUILD_EXECUTABLE)