OSDN Git Service

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