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/route.c \
143     toys/pending/tar.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/ps.c \
182     toys/posix/pwd.c \
183     toys/posix/renice.c \
184     toys/posix/rm.c \
185     toys/posix/rmdir.c \
186     toys/posix/sed.c \
187     toys/posix/sleep.c \
188     toys/posix/sort.c \
189     toys/posix/split.c \
190     toys/posix/strings.c \
191     toys/posix/tail.c \
192     toys/posix/tee.c \
193     toys/posix/time.c \
194     toys/posix/touch.c \
195     toys/posix/true.c \
196     toys/posix/tty.c \
197     toys/posix/ulimit.c \
198     toys/posix/uname.c \
199     toys/posix/uniq.c \
200     toys/posix/wc.c \
201     toys/posix/xargs.c \
202
203 LOCAL_CFLAGS += \
204     -std=c99 \
205     -Os \
206     -Wno-char-subscripts \
207     -Wno-sign-compare \
208     -Wno-string-plus-int \
209     -Wno-uninitialized \
210     -Wno-unused-parameter \
211     -funsigned-char \
212     -ffunction-sections -fdata-sections \
213     -fno-asynchronous-unwind-tables \
214
215 toybox_upstream_version := $(shell awk 'match($$0, /TOYBOX_VERSION.*"(.*)"/, ary) {print ary[1]}' $(LOCAL_PATH)/main.c)
216 toybox_sha := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)
217
218 toybox_version := $(toybox_upstream_version)-$(toybox_sha)-android
219 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
220
221 LOCAL_CLANG := true
222
223 LOCAL_SHARED_LIBRARIES := libcutils libselinux
224
225 # This doesn't actually prevent us from dragging in libc++ at runtime
226 # because libnetd_client.so is C++.
227 LOCAL_CXX_STL := none
228
229 LOCAL_MODULE := toybox
230
231 # dupes: dd
232 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
233 #           partprobe pivot_root pwdx rev rfkill vconfig
234 # prefer BSD netcat instead?: nc netcat
235 # prefer efs2progs instead?: blkid chattr lsattr
236
237 ALL_TOOLS := \
238     acpi \
239     base64 \
240     basename \
241     blockdev \
242     bzcat \
243     cal \
244     cat \
245     chcon \
246     chgrp \
247     chmod \
248     chown \
249     chroot \
250     cksum \
251     clear \
252     comm \
253     cmp \
254     cp \
255     cpio \
256     cut \
257     date \
258     df \
259     dirname \
260     dmesg \
261     dos2unix \
262     du \
263     echo \
264     env \
265     expand \
266     expr \
267     fallocate \
268     false \
269     find \
270     flock \
271     free \
272     getenforce \
273     getprop \
274     groups \
275     head \
276     hostname \
277     hwclock \
278     id \
279     ifconfig \
280     inotifyd \
281     insmod \
282     ionice \
283     iorenice \
284     kill \
285     killall \
286     load_policy \
287     ln \
288     logname \
289     losetup \
290     ls \
291     lsmod \
292     lsof \
293     lsusb \
294     md5sum \
295     mkdir \
296     mknod \
297     mkswap \
298     mktemp \
299     modinfo \
300     more \
301     mount \
302     mountpoint \
303     mv \
304     netstat \
305     nice \
306     nl \
307     nohup \
308     od \
309     paste \
310     patch \
311     pgrep \
312     pidof \
313     pkill \
314     pmap \
315     printenv \
316     printf \
317     pwd \
318     readlink \
319     realpath \
320     renice \
321     restorecon \
322     rm \
323     rmdir \
324     rmmod \
325     route \
326     runcon \
327     sed \
328     seq \
329     setenforce \
330     setprop \
331     setsid \
332     sha1sum \
333     sleep \
334     sort \
335     split \
336     stat \
337     strings \
338     swapoff \
339     swapon \
340     sync \
341     sysctl \
342     tac \
343     tail \
344     tar \
345     taskset \
346     tee \
347     time \
348     timeout \
349     touch \
350     tr \
351     true \
352     truncate \
353     tty \
354     ulimit \
355     umount \
356     uname \
357     uniq \
358     unix2dos \
359     uptime \
360     usleep \
361     vmstat \
362     wc \
363     which \
364     whoami \
365     xargs \
366     xxd \
367     yes \
368
369 # Install the symlinks.
370 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
371
372 include $(BUILD_EXECUTABLE)