OSDN Git Service

am 77538439: Switch to toybox lsof.
[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/lsof.c \
138     toys/pending/more.c \
139     toys/pending/pgrep.c \
140     toys/pending/netstat.c \
141     toys/pending/route.c \
142     toys/pending/tar.c \
143     toys/pending/top.c \
144     toys/pending/tr.c \
145     toys/pending/traceroute.c \
146     toys/posix/basename.c \
147     toys/posix/cal.c \
148     toys/posix/cat.c \
149     toys/posix/chgrp.c \
150     toys/posix/chmod.c \
151     toys/posix/cksum.c \
152     toys/posix/cmp.c \
153     toys/posix/comm.c \
154     toys/posix/cp.c \
155     toys/posix/cpio.c \
156     toys/posix/cut.c \
157     toys/posix/date.c \
158     toys/posix/df.c \
159     toys/posix/dirname.c \
160     toys/posix/du.c \
161     toys/posix/echo.c \
162     toys/posix/env.c \
163     toys/posix/expand.c \
164     toys/posix/false.c \
165     toys/posix/find.c \
166     toys/posix/grep.c \
167     toys/posix/head.c \
168     toys/posix/id.c \
169     toys/posix/kill.c \
170     toys/posix/ln.c \
171     toys/posix/ls.c \
172     toys/posix/mkdir.c \
173     toys/posix/mkfifo.c \
174     toys/posix/nice.c \
175     toys/posix/nl.c \
176     toys/posix/nohup.c \
177     toys/posix/od.c \
178     toys/posix/paste.c \
179     toys/posix/patch.c \
180     toys/posix/printf.c \
181     toys/posix/pwd.c \
182     toys/posix/renice.c \
183     toys/posix/rm.c \
184     toys/posix/rmdir.c \
185     toys/posix/sed.c \
186     toys/posix/sleep.c \
187     toys/posix/sort.c \
188     toys/posix/split.c \
189     toys/posix/strings.c \
190     toys/posix/tail.c \
191     toys/posix/tee.c \
192     toys/posix/time.c \
193     toys/posix/touch.c \
194     toys/posix/true.c \
195     toys/posix/tty.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_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
214 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
215
216 LOCAL_CLANG := true
217
218 LOCAL_SHARED_LIBRARIES := libcutils libselinux
219
220 # This doesn't actually prevent us from dragging in libc++ at runtime
221 # because libnetd_client.so is C++.
222 LOCAL_CXX_STL := none
223
224 LOCAL_MODULE := toybox
225
226 # dupes: dd df du
227 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
228 #           partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
229 # prefer BSD netcat instead?: nc netcat
230 # prefer efs2progs instead?: blkid chattr lsattr
231
232 ALL_TOOLS := \
233     acpi \
234     base64 \
235     basename \
236     blockdev \
237     bzcat \
238     cal \
239     cat \
240     chcon \
241     chgrp \
242     chmod \
243     chown \
244     chroot \
245     cksum \
246     clear \
247     comm \
248     cmp \
249     cp \
250     cpio \
251     cut \
252     date \
253     dirname \
254     dmesg \
255     dos2unix \
256     echo \
257     env \
258     expand \
259     expr \
260     fallocate \
261     false \
262     find \
263     free \
264     getenforce \
265     getprop \
266     groups \
267     head \
268     hostname \
269     hwclock \
270     id \
271     ifconfig \
272     inotifyd \
273     insmod \
274     ionice \
275     iorenice \
276     kill \
277     killall \
278     load_policy \
279     ln \
280     logname \
281     losetup \
282     ls \
283     lsmod \
284     lsof \
285     lsusb \
286     md5sum \
287     mkdir \
288     mknod \
289     mkswap \
290     mktemp \
291     modinfo \
292     more \
293     mount \
294     mountpoint \
295     mv \
296     netstat \
297     nice \
298     nl \
299     nohup \
300     od \
301     paste \
302     patch \
303     pgrep \
304     pidof \
305     pkill \
306     pmap \
307     printenv \
308     printf \
309     pwd \
310     readlink \
311     realpath \
312     renice \
313     restorecon \
314     rm \
315     rmdir \
316     rmmod \
317     route \
318     runcon \
319     sed \
320     seq \
321     setenforce \
322     setprop \
323     setsid \
324     sha1sum \
325     sleep \
326     sort \
327     split \
328     stat \
329     strings \
330     swapoff \
331     swapon \
332     sync \
333     sysctl \
334     tac \
335     tail \
336     tar \
337     taskset \
338     tee \
339     time \
340     timeout \
341     touch \
342     tr \
343     true \
344     truncate \
345     tty \
346     umount \
347     uname \
348     uniq \
349     unix2dos \
350     uptime \
351     usleep \
352     vmstat \
353     wc \
354     which \
355     whoami \
356     xargs \
357     xxd \
358     yes \
359
360 # Install the symlinks.
361 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
362
363 include $(BUILD_EXECUTABLE)