OSDN Git Service

am b2fcb6c8: (-s ours) am efac088b: Merge remote-tracking branch \'toybox/master...
[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/usleep.c \
129     toys/other/vconfig.c \
130     toys/other/vmstat.c \
131     toys/other/which.c \
132     toys/other/xxd.c \
133     toys/other/yes.c \
134     toys/pending/dd.c \
135     toys/pending/expr.c \
136     toys/pending/more.c \
137     toys/pending/pgrep.c \
138     toys/pending/netstat.c \
139     toys/pending/route.c \
140     toys/pending/tar.c \
141     toys/pending/top.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/pwd.c \
180     toys/posix/renice.c \
181     toys/posix/rm.c \
182     toys/posix/rmdir.c \
183     toys/posix/sed.c \
184     toys/posix/sleep.c \
185     toys/posix/sort.c \
186     toys/posix/split.c \
187     toys/posix/strings.c \
188     toys/posix/tail.c \
189     toys/posix/tee.c \
190     toys/posix/time.c \
191     toys/posix/touch.c \
192     toys/posix/true.c \
193     toys/posix/tty.c \
194     toys/posix/uname.c \
195     toys/posix/uniq.c \
196     toys/posix/wc.c \
197     toys/posix/xargs.c \
198
199 LOCAL_CFLAGS += \
200     -std=c99 \
201     -Os \
202     -Wno-char-subscripts \
203     -Wno-sign-compare \
204     -Wno-string-plus-int \
205     -Wno-uninitialized \
206     -Wno-unused-parameter \
207     -funsigned-char \
208     -ffunction-sections -fdata-sections \
209     -fno-asynchronous-unwind-tables \
210
211 toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
212 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
213
214 LOCAL_CLANG := true
215
216 LOCAL_SHARED_LIBRARIES := libcutils libselinux
217
218 # This doesn't actually prevent us from dragging in libc++ at runtime
219 # because libnetd_client.so is C++.
220 LOCAL_CXX_STL := none
221
222 LOCAL_MODULE := toybox
223
224 # dupes: dd df du ls
225 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
226 #           partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
227 # prefer BSD netcat instead?: nc netcat
228 # prefer efs2progs instead?: blkid chattr lsattr
229
230 ALL_TOOLS := \
231     acpi \
232     base64 \
233     basename \
234     blockdev \
235     bzcat \
236     cal \
237     cat \
238     chcon \
239     chgrp \
240     chmod \
241     chown \
242     chroot \
243     cksum \
244     clear \
245     comm \
246     cmp \
247     cp \
248     cpio \
249     cut \
250     date \
251     dirname \
252     dmesg \
253     dos2unix \
254     echo \
255     env \
256     expand \
257     expr \
258     fallocate \
259     false \
260     find \
261     free \
262     getenforce \
263     getprop \
264     groups \
265     head \
266     hostname \
267     hwclock \
268     id \
269     ifconfig \
270     inotifyd \
271     insmod \
272     ionice \
273     iorenice \
274     kill \
275     load_policy \
276     ln \
277     logname \
278     losetup \
279     lsmod \
280     lsusb \
281     md5sum \
282     mkdir \
283     mknod \
284     mkswap \
285     mktemp \
286     modinfo \
287     more \
288     mount \
289     mountpoint \
290     mv \
291     netstat \
292     nice \
293     nl \
294     nohup \
295     od \
296     paste \
297     patch \
298     pgrep \
299     pidof \
300     pkill \
301     pmap \
302     printenv \
303     printf \
304     pwd \
305     readlink \
306     realpath \
307     renice \
308     restorecon \
309     rm \
310     rmdir \
311     rmmod \
312     route \
313     runcon \
314     sed \
315     seq \
316     setenforce \
317     setprop \
318     setsid \
319     sha1sum \
320     sleep \
321     sort \
322     split \
323     stat \
324     strings \
325     swapoff \
326     swapon \
327     sync \
328     sysctl \
329     tac \
330     tail \
331     tar \
332     taskset \
333     tee \
334     time \
335     timeout \
336     touch \
337     tr \
338     true \
339     truncate \
340     tty \
341     umount \
342     uname \
343     uniq \
344     unix2dos \
345     usleep \
346     vmstat \
347     wc \
348     which \
349     whoami \
350     xargs \
351     xxd \
352     yes \
353
354 # Install the symlinks.
355 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
356
357 include $(BUILD_EXECUTABLE)