OSDN Git Service

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