Android.mk revision d67730eb9ae4f387fc2d50a8210e789b1509288e
1#
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/landley/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
36#
37# To add a toy:
38#
39
40#  make menuconfig
41#  # (Select the toy you want to add.)
42#  make clean && make  # Regenerate the generated files.
43#  # Edit LOCAL_SRC_FILES below to add the toy.
44#  # If you just want to use it as "toybox x" rather than "x", you can stop now.
45#  # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS.
46
47include $(CLEAR_VARS)
48
49LOCAL_SRC_FILES := \
50    lib/args.c \
51    lib/dirtree.c \
52    lib/getmountlist.c \
53    lib/help.c \
54    lib/lib.c \
55    lib/llist.c \
56    lib/net.c \
57    lib/portability.c \
58    lib/xwrap.c \
59    main.c \
60    toys/android/getenforce.c \
61    toys/android/getprop.c \
62    toys/android/load_policy.c \
63    toys/android/restorecon.c \
64    toys/android/runcon.c \
65    toys/android/setenforce.c \
66    toys/android/setprop.c \
67    toys/lsb/dmesg.c \
68    toys/lsb/hostname.c \
69    toys/lsb/killall.c \
70    toys/lsb/md5sum.c \
71    toys/lsb/mknod.c \
72    toys/lsb/mktemp.c \
73    toys/lsb/mount.c \
74    toys/lsb/pidof.c \
75    toys/lsb/seq.c \
76    toys/lsb/sync.c \
77    toys/lsb/umount.c \
78    toys/other/acpi.c \
79    toys/other/base64.c \
80    toys/other/blkid.c \
81    toys/other/blockdev.c \
82    toys/other/bzcat.c \
83    toys/other/chcon.c \
84    toys/other/chroot.c \
85    toys/other/clear.c \
86    toys/other/dos2unix.c \
87    toys/other/fallocate.c \
88    toys/other/free.c \
89    toys/other/freeramdisk.c \
90    toys/other/fsfreeze.c \
91    toys/other/help.c \
92    toys/other/ifconfig.c \
93    toys/other/inotifyd.c \
94    toys/other/insmod.c \
95    toys/other/losetup.c \
96    toys/other/lsattr.c \
97    toys/other/lsmod.c \
98    toys/other/lspci.c \
99    toys/other/lsusb.c \
100    toys/other/makedevs.c \
101    toys/other/mkswap.c \
102    toys/other/modinfo.c \
103    toys/other/mountpoint.c \
104    toys/other/nbd_client.c \
105    toys/other/netcat.c \
106    toys/other/partprobe.c \
107    toys/other/pivot_root.c \
108    toys/other/pmap.c \
109    toys/other/printenv.c \
110    toys/other/pwdx.c \
111    toys/other/readlink.c \
112    toys/other/realpath.c \
113    toys/other/rev.c \
114    toys/other/rfkill.c \
115    toys/other/rmmod.c \
116    toys/other/setsid.c \
117    toys/other/stat.c \
118    toys/other/swapoff.c \
119    toys/other/swapon.c \
120    toys/other/switch_root.c \
121    toys/other/sysctl.c \
122    toys/other/tac.c \
123    toys/other/taskset.c \
124    toys/other/timeout.c \
125    toys/other/truncate.c \
126    toys/other/usleep.c \
127    toys/other/vconfig.c \
128    toys/other/vmstat.c \
129    toys/other/which.c \
130    toys/other/yes.c \
131    toys/pending/dd.c \
132    toys/pending/expr.c \
133    toys/pending/hwclock.c \
134    toys/pending/more.c \
135    toys/pending/pgrep.c \
136    toys/pending/netstat.c \
137    toys/pending/route.c \
138    toys/pending/tar.c \
139    toys/pending/top.c \
140    toys/pending/tr.c \
141    toys/pending/traceroute.c \
142    toys/posix/basename.c \
143    toys/posix/cal.c \
144    toys/posix/cat.c \
145    toys/posix/chgrp.c \
146    toys/posix/chmod.c \
147    toys/posix/cksum.c \
148    toys/posix/cmp.c \
149    toys/posix/comm.c \
150    toys/posix/cp.c \
151    toys/posix/cpio.c \
152    toys/posix/cut.c \
153    toys/posix/date.c \
154    toys/posix/df.c \
155    toys/posix/dirname.c \
156    toys/posix/du.c \
157    toys/posix/echo.c \
158    toys/posix/env.c \
159    toys/posix/expand.c \
160    toys/posix/false.c \
161    toys/posix/find.c \
162    toys/posix/grep.c \
163    toys/posix/head.c \
164    toys/posix/id.c \
165    toys/posix/kill.c \
166    toys/posix/ln.c \
167    toys/posix/ls.c \
168    toys/posix/mkdir.c \
169    toys/posix/mkfifo.c \
170    toys/posix/nice.c \
171    toys/posix/nl.c \
172    toys/posix/nohup.c \
173    toys/posix/od.c \
174    toys/posix/paste.c \
175    toys/posix/patch.c \
176    toys/posix/printf.c \
177    toys/posix/pwd.c \
178    toys/posix/renice.c \
179    toys/posix/rm.c \
180    toys/posix/rmdir.c \
181    toys/posix/sed.c \
182    toys/posix/sleep.c \
183    toys/posix/sort.c \
184    toys/posix/split.c \
185    toys/posix/strings.c \
186    toys/posix/tail.c \
187    toys/posix/tee.c \
188    toys/posix/time.c \
189    toys/posix/touch.c \
190    toys/posix/true.c \
191    toys/posix/tty.c \
192    toys/posix/uname.c \
193    toys/posix/uniq.c \
194    toys/posix/wc.c \
195    toys/posix/xargs.c \
196
197LOCAL_CFLAGS += \
198    -std=c99 \
199    -Os \
200    -Wno-char-subscripts \
201    -Wno-sign-compare \
202    -Wno-string-plus-int \
203    -Wno-uninitialized \
204    -Wno-unused-parameter \
205    -funsigned-char \
206    -ffunction-sections -fdata-sections \
207    -fno-asynchronous-unwind-tables \
208
209toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
210LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
211
212LOCAL_CLANG := true
213
214LOCAL_SHARED_LIBRARIES := libcutils libselinux
215
216LOCAL_MODULE := toybox
217
218# dupes: dd df du ls mount renice
219# useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
220#           partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
221# prefer BSD netcat instead?: nc netcat
222# prefer efs2progs instead?: blkid chattr lsattr
223
224ALL_TOOLS := \
225    acpi \
226    basename \
227    blockdev \
228    bzcat \
229    cal \
230    cat \
231    chcon \
232    chgrp \
233    chmod \
234    chown \
235    chroot \
236    cksum \
237    clear \
238    comm \
239    cmp \
240    cp \
241    cpio \
242    cut \
243    date \
244    dirname \
245    dmesg \
246    dos2unix \
247    echo \
248    env \
249    expand \
250    expr \
251    fallocate \
252    false \
253    find \
254    free \
255    getenforce \
256    getprop \
257    groups \
258    head \
259    hostname \
260    hwclock \
261    id \
262    ifconfig \
263    inotifyd \
264    insmod \
265    kill \
266    killall \
267    load_policy \
268    ln \
269    logname \
270    losetup \
271    lsmod \
272    lspci \
273    lsusb \
274    md5sum \
275    mkdir \
276    mknod \
277    mkswap \
278    mktemp \
279    modinfo \
280    more \
281    mountpoint \
282    mv \
283    netstat \
284    nice \
285    nl \
286    nohup \
287    od \
288    paste \
289    patch \
290    pgrep \
291    pidof \
292    pkill \
293    pmap \
294    printenv \
295    printf \
296    pwd \
297    readlink \
298    realpath \
299    restorecon \
300    rm \
301    rmdir \
302    rmmod \
303    route \
304    runcon \
305    sed \
306    seq \
307    setenforce \
308    setprop \
309    setsid \
310    sha1sum \
311    sleep \
312    sort \
313    split \
314    stat \
315    strings \
316    swapoff \
317    swapon \
318    sync \
319    sysctl \
320    tac \
321    tail \
322    tar \
323    taskset \
324    tee \
325    time \
326    timeout \
327    touch \
328    tr \
329    true \
330    truncate \
331    umount \
332    uname \
333    uniq \
334    unix2dos \
335    usleep \
336    vmstat \
337    wc \
338    which \
339    whoami \
340    xargs \
341    yes \
342
343# Install the symlinks.
344LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
345
346include $(BUILD_EXECUTABLE)
347