OSDN Git Service

Stop building getprop am: 2a7219cdf2
[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 sync with upstream:
21 #
22
23 #  # Update.
24 #  git remote add toybox https://github.com/landley/toybox.git
25 #  git fetch toybox
26 #  git merge toybox/master
27
28 #  # Regenerate generated files.
29 #  make
30
31 #  # Make any necessary Android.mk changes and rebuild.
32 #  mm -j32
33
34 #  # Run tests.
35 #  ./run-tests-on-android.sh
36 #  # Run a single test.
37 #  ./run-tests-on-android.sh wc
38
39 #  # Upload changes.
40 #  git commit -a --amend
41 #  git push aosp HEAD:refs/for/master  # Push to gerrit for review.
42 #  git push aosp HEAD:master  # Push directly, avoiding gerrit.
43
44
45 #
46 # To add a toy:
47 #
48
49 #  Edit .config to enable the toy you want to add.
50 #  make clean && make  # Regenerate the generated files.
51 #  # Edit LOCAL_SRC_FILES below to add the toy.
52 #  # If you just want to use it as "toybox x" rather than "x", you can stop now.
53 #  # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS.
54
55 common_SRC_FILES := \
56     lib/args.c \
57     lib/dirtree.c \
58     lib/getmountlist.c \
59     lib/help.c \
60     lib/interestingtimes.c \
61     lib/lib.c \
62     lib/linestack.c \
63     lib/llist.c \
64     lib/net.c \
65     lib/portability.c \
66     lib/xwrap.c \
67     main.c \
68     toys/android/getenforce.c \
69     toys/android/load_policy.c \
70     toys/android/log.c \
71     toys/android/restorecon.c \
72     toys/android/runcon.c \
73     toys/android/sendevent.c \
74     toys/android/setenforce.c \
75     toys/android/setprop.c \
76     toys/android/start.c \
77     toys/lsb/dmesg.c \
78     toys/lsb/hostname.c \
79     toys/lsb/killall.c \
80     toys/lsb/md5sum.c \
81     toys/lsb/mknod.c \
82     toys/lsb/mktemp.c \
83     toys/lsb/mount.c \
84     toys/lsb/pidof.c \
85     toys/lsb/seq.c \
86     toys/lsb/sync.c \
87     toys/lsb/umount.c \
88     toys/net/ifconfig.c \
89     toys/net/microcom.c \
90     toys/net/netcat.c \
91     toys/net/netstat.c \
92     toys/net/rfkill.c \
93     toys/net/tunctl.c \
94     toys/other/acpi.c \
95     toys/other/base64.c \
96     toys/other/blkid.c \
97     toys/other/blockdev.c \
98     toys/other/chcon.c \
99     toys/other/chroot.c \
100     toys/other/chrt.c \
101     toys/other/clear.c \
102     toys/other/dos2unix.c \
103     toys/other/fallocate.c \
104     toys/other/flock.c \
105     toys/other/free.c \
106     toys/other/freeramdisk.c \
107     toys/other/fsfreeze.c \
108     toys/other/help.c \
109     toys/other/hwclock.c \
110     toys/other/inotifyd.c \
111     toys/other/insmod.c \
112     toys/other/ionice.c \
113     toys/other/losetup.c \
114     toys/other/lsattr.c \
115     toys/other/lsmod.c \
116     toys/other/lspci.c \
117     toys/other/lsusb.c \
118     toys/other/makedevs.c \
119     toys/other/mkswap.c \
120     toys/other/modinfo.c \
121     toys/other/mountpoint.c \
122     toys/other/nbd_client.c \
123     toys/other/partprobe.c \
124     toys/other/pivot_root.c \
125     toys/other/pmap.c \
126     toys/other/printenv.c \
127     toys/other/pwdx.c \
128     toys/other/readlink.c \
129     toys/other/realpath.c \
130     toys/other/rev.c \
131     toys/other/rmmod.c \
132     toys/other/setsid.c \
133     toys/other/stat.c \
134     toys/other/swapoff.c \
135     toys/other/swapon.c \
136     toys/other/sysctl.c \
137     toys/other/tac.c \
138     toys/other/taskset.c \
139     toys/other/timeout.c \
140     toys/other/truncate.c \
141     toys/other/uptime.c \
142     toys/other/usleep.c \
143     toys/other/vconfig.c \
144     toys/other/vmstat.c \
145     toys/other/which.c \
146     toys/other/xxd.c \
147     toys/other/yes.c \
148     toys/pending/dd.c \
149     toys/pending/diff.c \
150     toys/pending/expr.c \
151     toys/pending/getfattr.c \
152     toys/pending/gzip.c \
153     toys/pending/lsof.c \
154     toys/pending/modprobe.c \
155     toys/pending/more.c \
156     toys/pending/setfattr.c \
157     toys/pending/stty.c \
158     toys/pending/tar.c \
159     toys/pending/tr.c \
160     toys/pending/traceroute.c \
161     toys/posix/basename.c \
162     toys/posix/cal.c \
163     toys/posix/cat.c \
164     toys/posix/chgrp.c \
165     toys/posix/chmod.c \
166     toys/posix/cksum.c \
167     toys/posix/cmp.c \
168     toys/posix/comm.c \
169     toys/posix/cp.c \
170     toys/posix/cpio.c \
171     toys/posix/cut.c \
172     toys/posix/date.c \
173     toys/posix/df.c \
174     toys/posix/dirname.c \
175     toys/posix/du.c \
176     toys/posix/echo.c \
177     toys/posix/env.c \
178     toys/posix/expand.c \
179     toys/posix/false.c \
180     toys/posix/file.c \
181     toys/posix/find.c \
182     toys/posix/grep.c \
183     toys/posix/head.c \
184     toys/posix/id.c \
185     toys/posix/kill.c \
186     toys/posix/ln.c \
187     toys/posix/ls.c \
188     toys/posix/mkdir.c \
189     toys/posix/mkfifo.c \
190     toys/posix/nice.c \
191     toys/posix/nl.c \
192     toys/posix/nohup.c \
193     toys/posix/od.c \
194     toys/posix/paste.c \
195     toys/posix/patch.c \
196     toys/posix/printf.c \
197     toys/posix/ps.c \
198     toys/posix/pwd.c \
199     toys/posix/renice.c \
200     toys/posix/rm.c \
201     toys/posix/rmdir.c \
202     toys/posix/sed.c \
203     toys/posix/sleep.c \
204     toys/posix/sort.c \
205     toys/posix/split.c \
206     toys/posix/strings.c \
207     toys/posix/tail.c \
208     toys/posix/tee.c \
209     toys/posix/time.c \
210     toys/posix/touch.c \
211     toys/posix/true.c \
212     toys/posix/tty.c \
213     toys/posix/ulimit.c \
214     toys/posix/uname.c \
215     toys/posix/uniq.c \
216     toys/posix/uudecode.c \
217     toys/posix/uuencode.c \
218     toys/posix/wc.c \
219     toys/posix/xargs.c \
220
221 common_CFLAGS := \
222     -std=gnu11 \
223     -Os \
224     -Wall -Werror \
225     -Wno-char-subscripts \
226     -Wno-gnu-variable-sized-type-not-at-end \
227     -Wno-missing-field-initializers \
228     -Wno-sign-compare \
229     -Wno-string-plus-int \
230     -Wno-uninitialized \
231     -Wno-unused-parameter \
232     -funsigned-char \
233     -ffunction-sections -fdata-sections \
234     -fno-asynchronous-unwind-tables \
235
236 toybox_libraries := liblog libselinux libcutils libcrypto libz
237
238 common_CFLAGS += -DTOYBOX_VENDOR=\"-android\"
239
240 # not usable on Android?: freeramdisk fsfreeze install makedevs nbd-client
241 #                         partprobe pivot_root pwdx rev rfkill vconfig
242 # currently prefer BSD system/core/toolbox: dd
243 # currently prefer BSD external/netcat: nc netcat
244 # currently prefer external/efs2progs: blkid chattr lsattr
245
246 ALL_TOOLS := \
247     acpi \
248     base64 \
249     basename \
250     blockdev \
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     diff \
269     dirname \
270     dmesg \
271     dos2unix \
272     du \
273     echo \
274     env \
275     expand \
276     expr \
277     fallocate \
278     false \
279     file \
280     find \
281     flock \
282     free \
283     getenforce \
284     groups \
285     gunzip \
286     gzip \
287     head \
288     hostname \
289     hwclock \
290     id \
291     ifconfig \
292     inotifyd \
293     insmod \
294     ionice \
295     iorenice \
296     kill \
297     killall \
298     load_policy \
299     ln \
300     log \
301     logname \
302     losetup \
303     ls \
304     lsmod \
305     lsof \
306     lspci \
307     lsusb \
308     md5sum \
309     mkdir \
310     mkfifo \
311     mknod \
312     mkswap \
313     mktemp \
314     microcom \
315     modinfo \
316     modprobe \
317     more \
318     mount \
319     mountpoint \
320     mv \
321     netstat \
322     nice \
323     nl \
324     nohup \
325     od \
326     paste \
327     patch \
328     pgrep \
329     pidof \
330     pkill \
331     pmap \
332     printenv \
333     printf \
334     ps \
335     pwd \
336     readlink \
337     realpath \
338     renice \
339     restorecon \
340     rm \
341     rmdir \
342     rmmod \
343     runcon \
344     sed \
345     sendevent \
346     seq \
347     setenforce \
348     setprop \
349     setsid \
350     sha1sum \
351     sha224sum \
352     sha256sum \
353     sha384sum \
354     sha512sum \
355     sleep \
356     sort \
357     split \
358     start \
359     stat \
360     stop \
361     strings \
362     stty \
363     swapoff \
364     swapon \
365     sync \
366     sysctl \
367     tac \
368     tail \
369     tar \
370     taskset \
371     tee \
372     time \
373     timeout \
374     top \
375     touch \
376     tr \
377     true \
378     truncate \
379     tty \
380     ulimit \
381     umount \
382     uname \
383     uniq \
384     unix2dos \
385     uptime \
386     usleep \
387     uudecode \
388     uuencode \
389     vmstat \
390     wc \
391     which \
392     whoami \
393     xargs \
394     xxd \
395     yes \
396     zcat \
397
398 ############################################
399 # toybox for /system
400 ############################################
401
402 include $(CLEAR_VARS)
403 LOCAL_MODULE := toybox
404 LOCAL_SRC_FILES := $(common_SRC_FILES)
405 LOCAL_CFLAGS := $(common_CFLAGS)
406 LOCAL_SHARED_LIBRARIES := $(toybox_libraries)
407 # This doesn't actually prevent us from dragging in libc++ at runtime
408 # because libnetd_client.so is C++.
409 LOCAL_CXX_STL := none
410 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
411 include $(BUILD_EXECUTABLE)
412
413 ############################################
414 # toybox for /vendor
415 ############################################
416
417 include $(CLEAR_VARS)
418 LOCAL_MODULE := toybox_vendor
419 LOCAL_VENDOR_MODULE := true
420 LOCAL_SRC_FILES := $(common_SRC_FILES)
421 LOCAL_CFLAGS := $(common_CFLAGS)
422 LOCAL_STATIC_LIBRARIES := libcutils libcrypto libz
423 LOCAL_SHARED_LIBRARIES := libselinux liblog
424 LOCAL_MODULE_TAGS := optional
425 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf ${LOCAL_MODULE} $(TARGET_OUT_VENDOR_EXECUTABLES)/$(t);)
426 include $(BUILD_EXECUTABLE)
427
428 ############################################
429 # static version to be installed in recovery
430 ############################################
431
432 include $(CLEAR_VARS)
433 LOCAL_MODULE := toybox_static
434 LOCAL_SRC_FILES := $(common_SRC_FILES)
435 LOCAL_CFLAGS := $(common_CFLAGS)
436 LOCAL_STATIC_LIBRARIES := $(toybox_libraries)
437 # libc++_static is needed by static liblog
438 LOCAL_CXX_STL := libc++_static
439 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
440 LOCAL_FORCE_STATIC_EXECUTABLE := true
441 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf ${LOCAL_MODULE} $(LOCAL_MODULE_PATH)/$(t);)
442 include $(BUILD_EXECUTABLE)