OSDN Git Service

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