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