OSDN Git Service

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