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