2 # Copyright (C) 2014 The Android Open Source Project
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 LOCAL_PATH := $(call my-dir)
23 # git remote add toybox https://github.com/landley/toybox.git
25 # git merge toybox/master
27 # # (Make any necessary Android.mk changes and test the new toybox.)
29 # git push aosp HEAD:refs/for/master # Push to gerrit for review.
30 # git push aosp HEAD:master # Push directly, avoiding gerrit.
32 # # Now commit any necessary Android.mk changes like normal:
33 # repo start post-sync .
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.
54 lib/interestingtimes.c \
62 toys/android/getenforce.c \
63 toys/android/getprop.c \
64 toys/android/load_policy.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 \
91 toys/other/blockdev.c \
96 toys/other/dos2unix.c \
97 toys/other/fallocate.c \
100 toys/other/freeramdisk.c \
101 toys/other/fsfreeze.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 \
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 \
119 toys/other/printenv.c \
121 toys/other/readlink.c \
122 toys/other/realpath.c \
125 toys/other/setsid.c \
127 toys/other/swapoff.c \
128 toys/other/swapon.c \
129 toys/other/sysctl.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 \
141 toys/pending/chrt.c \
143 toys/pending/expr.c \
144 toys/pending/getfattr.c \
145 toys/pending/lsof.c \
146 toys/pending/microcom.c \
147 toys/pending/more.c \
148 toys/pending/setfattr.c \
151 toys/pending/traceroute.c \
152 toys/posix/basename.c \
165 toys/posix/dirname.c \
169 toys/posix/expand.c \
180 toys/posix/mkfifo.c \
187 toys/posix/printf.c \
190 toys/posix/renice.c \
197 toys/posix/strings.c \
204 toys/posix/ulimit.c \
207 toys/posix/uudecode.c \
208 toys/posix/uuencode.c \
215 -Wno-char-subscripts \
217 -Wno-string-plus-int \
219 -Wno-unused-parameter \
221 -ffunction-sections -fdata-sections \
222 -fno-asynchronous-unwind-tables \
224 toybox_upstream_version := $(shell awk 'match($$0, /TOYBOX_VERSION.*"(.*)"/, ary) {print ary[1]}' $(LOCAL_PATH)/main.c)
225 toybox_sha := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)
227 toybox_version := $(toybox_upstream_version)-$(toybox_sha)-android
228 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
232 LOCAL_SHARED_LIBRARIES := liblog libcutils libselinux libcrypto
234 # This doesn't actually prevent us from dragging in libc++ at runtime
235 # because libnetd_client.so is C++.
236 LOCAL_CXX_STL := none
238 LOCAL_MODULE := toybox
241 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
242 # partprobe pivot_root pwdx rev rfkill vconfig
243 # prefer BSD netcat instead?: nc netcat
244 # prefer efs2progs instead?: blkid chattr lsattr
392 # Install the symlinks.
393 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
395 include $(BUILD_EXECUTABLE)