OSDN Git Service

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