blob: bad42aa49bfdd8c986e6e769c9b446ef6303387c [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 Hughes9aaeff32015-01-14 12:26:10 -0800117 toys/pending/hwclock.c \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800118 toys/pending/more.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800119 toys/pending/ps.c \
120 toys/pending/netstat.c \
121 toys/pending/route.c \
Elliott Hughesf9551b32014-12-24 10:59:08 -0800122 toys/pending/setenforce.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800123 toys/pending/top.c \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800124 toys/pending/tr.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800125 toys/pending/traceroute.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800126 toys/posix/basename.c \
127 toys/posix/cal.c \
128 toys/posix/cat.c \
129 toys/posix/chgrp.c \
130 toys/posix/chmod.c \
131 toys/posix/cksum.c \
132 toys/posix/cmp.c \
133 toys/posix/comm.c \
134 toys/posix/cp.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 \
185 -funsigned-char -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables \
186
Elliott Hughes76115632014-12-16 09:14:47 -0800187LOCAL_SHARED_LIBRARIES := libselinux
188
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800189LOCAL_MODULE := toybox
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800190
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800191# dupes: chown cmp df du grep id ls
Elliott Hughes123aecf2015-01-14 11:00:47 -0800192# mount nc netcat renice
Elliott Hughes20800602014-11-25 17:25:05 -0800193# touch umount
Elliott Hughes5f172642014-12-16 21:31:36 -0800194# useless?: chvt freeramdisk fsfreeze install makedevs mkfifo mktemp nbd-client
195# partprobe pivot_root pwdx rev rfkill switch_root tty unshare vconfig
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800196# prefer efs2progs instead?: blkid chattr lsattr
197
198ALL_TOOLS := \
199 acpi \
200 basename \
201 blockdev \
202 bzcat \
203 cal \
Elliott Hughes1e0e5ea2015-01-14 10:40:22 -0800204 cat \
Elliott Hughes76115632014-12-16 09:14:47 -0800205 chcon \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800206 chgrp \
Elliott Hughes5c7cca02014-12-11 12:12:59 -0800207 chmod \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800208 chroot \
209 cksum \
Elliott Hughes03275a82014-11-22 22:56:47 -0800210 clear \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800211 comm \
Elliott Hughes6b4d05c2014-12-16 16:15:47 -0800212 cp \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800213 cut \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800214 date \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800215 dirname \
Elliott Hughesc99e20b2014-11-26 11:38:43 -0800216 dmesg \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800217 dos2unix \
218 echo \
219 egrep \
220 env \
221 expand \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800222 fallocate \
Elliott Hughes03275a82014-11-22 22:56:47 -0800223 false \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800224 fgrep \
225 find \
226 free \
Elliott Hughes9250c952014-12-24 11:29:44 -0800227 getenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800228 groups \
229 head \
230 hostname \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800231 hwclock \
Elliott Hughes4f060a32015-01-14 11:07:28 -0800232 ifconfig \
Elliott Hughes123aecf2015-01-14 11:00:47 -0800233 inotifyd \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800234 insmod \
Elliott Hughes95211ea2014-12-04 20:09:44 -0800235 kill \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800236 killall \
237 ln \
238 logname \
239 losetup \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800240 lsmod \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800241 lspci \
242 lsusb \
243 md5sum \
Elliott Hughesd13bf6a2014-12-16 15:17:17 -0800244 mkdir \
Elliott Hughes0a0435c2014-12-11 18:34:09 -0800245 mknod \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800246 mkswap \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800247 modinfo \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800248 more \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800249 mountpoint \
Elliott Hughesdbcacc62014-12-16 19:18:43 -0800250 mv \
Elliott Hughes5f9893b2014-12-23 09:12:18 -0800251 netstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800252 nice \
253 nl \
Elliott Hughes9f989412014-11-25 17:00:40 -0800254 nohup \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800255 od \
256 paste \
257 patch \
258 pidof \
259 pmap \
Elliott Hughes68e18cd2014-11-24 15:36:51 -0800260 printenv \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800261 pwd \
Elliott Hughes8f7bc7a2014-11-26 15:21:03 -0800262 readlink \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800263 realpath \
Elliott Hughesf5275f92014-12-16 16:22:32 -0800264 rm \
Elliott Hughesd4a6d662014-12-16 15:26:53 -0800265 rmdir \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800266 rmmod \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800267 sed \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800268 seq \
Elliott Hughes9250c952014-12-24 11:29:44 -0800269 setenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800270 setsid \
271 sha1sum \
Elliott Hughes62cf8d62014-11-24 15:23:04 -0800272 sleep \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800273 sort \
274 split \
275 stat \
276 strings \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800277 swapoff \
278 swapon \
Elliott Hughes85368282014-11-24 14:53:36 -0800279 sync \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800280 sysctl \
281 tac \
282 tail \
283 taskset \
284 tee \
285 time \
286 timeout \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800287 tr \
Elliott Hughes03275a82014-11-22 22:56:47 -0800288 true \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800289 truncate \
290 uname \
291 uniq \
292 unix2dos \
Elliott Hughes10bd49e2014-11-21 14:53:43 -0800293 usleep \
Elliott Hughes20800602014-11-25 17:25:05 -0800294 vmstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800295 wc \
296 which \
297 whoami \
298 xargs \
299 yes \
300
Ying Wang331b22d2014-11-24 12:42:09 -0800301# Install the symlinks.
302LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800303
Ying Wang331b22d2014-11-24 12:42:09 -0800304include $(BUILD_EXECUTABLE)