OSDN Git Service

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