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.)
28 # git push aosp HEAD:master # Push directly, avoiding gerrit.
29 # git push aosp HEAD:refs/for/master # Push to gerrit.
31 # # Now commit any necessary Android.mk changes like normal:
32 # repo start post-sync .
41 # # (Select 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.
60 toys/android/getenforce.c \
61 toys/android/getprop.c \
62 toys/android/load_policy.c \
63 toys/android/restorecon.c \
64 toys/android/runcon.c \
65 toys/android/setenforce.c \
66 toys/android/setprop.c \
81 toys/other/blockdev.c \
86 toys/other/dos2unix.c \
87 toys/other/fallocate.c \
89 toys/other/freeramdisk.c \
90 toys/other/fsfreeze.c \
92 toys/other/ifconfig.c \
93 toys/other/inotifyd.c \
95 toys/other/losetup.c \
100 toys/other/makedevs.c \
101 toys/other/mkswap.c \
102 toys/other/modinfo.c \
103 toys/other/mountpoint.c \
104 toys/other/nbd_client.c \
105 toys/other/netcat.c \
106 toys/other/partprobe.c \
107 toys/other/pivot_root.c \
109 toys/other/printenv.c \
111 toys/other/readlink.c \
112 toys/other/realpath.c \
114 toys/other/rfkill.c \
116 toys/other/setsid.c \
118 toys/other/swapoff.c \
119 toys/other/swapon.c \
120 toys/other/switch_root.c \
121 toys/other/sysctl.c \
123 toys/other/taskset.c \
124 toys/other/timeout.c \
125 toys/other/truncate.c \
126 toys/other/usleep.c \
127 toys/other/vconfig.c \
128 toys/other/vmstat.c \
132 toys/pending/expr.c \
133 toys/pending/hwclock.c \
134 toys/pending/more.c \
135 toys/pending/pgrep.c \
136 toys/pending/netstat.c \
137 toys/pending/route.c \
141 toys/pending/traceroute.c \
142 toys/posix/basename.c \
155 toys/posix/dirname.c \
159 toys/posix/expand.c \
169 toys/posix/mkfifo.c \
176 toys/posix/printf.c \
178 toys/posix/renice.c \
185 toys/posix/strings.c \
200 -Wno-char-subscripts \
202 -Wno-string-plus-int \
204 -Wno-unused-parameter \
206 -ffunction-sections -fdata-sections \
207 -fno-asynchronous-unwind-tables \
209 toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
210 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
214 LOCAL_SHARED_LIBRARIES := libcutils libselinux
216 LOCAL_MODULE := toybox
218 # dupes: dd df du ls mount renice
219 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
220 # partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
221 # prefer BSD netcat instead?: nc netcat
222 # prefer efs2progs instead?: blkid chattr lsattr
343 # Install the symlinks.
344 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
346 include $(BUILD_EXECUTABLE)