OSDN Git Service

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