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.
54 lib/interestingtimes.c \
61 toys/android/getenforce.c \
62 toys/android/getprop.c \
63 toys/android/load_policy.c \
64 toys/android/restorecon.c \
65 toys/android/runcon.c \
66 toys/android/setenforce.c \
67 toys/android/setprop.c \
82 toys/other/blockdev.c \
87 toys/other/dos2unix.c \
88 toys/other/fallocate.c \
90 toys/other/freeramdisk.c \
91 toys/other/fsfreeze.c \
93 toys/other/hwclock.c \
94 toys/other/ifconfig.c \
95 toys/other/inotifyd.c \
98 toys/other/losetup.c \
102 toys/other/makedevs.c \
103 toys/other/mkswap.c \
104 toys/other/modinfo.c \
105 toys/other/mountpoint.c \
106 toys/other/nbd_client.c \
107 toys/other/netcat.c \
108 toys/other/partprobe.c \
109 toys/other/pivot_root.c \
111 toys/other/printenv.c \
113 toys/other/readlink.c \
114 toys/other/realpath.c \
116 toys/other/rfkill.c \
118 toys/other/setsid.c \
120 toys/other/swapoff.c \
121 toys/other/swapon.c \
122 toys/other/switch_root.c \
123 toys/other/sysctl.c \
125 toys/other/taskset.c \
126 toys/other/timeout.c \
127 toys/other/truncate.c \
128 toys/other/usleep.c \
129 toys/other/vconfig.c \
130 toys/other/vmstat.c \
135 toys/pending/expr.c \
136 toys/pending/more.c \
137 toys/pending/pgrep.c \
138 toys/pending/netstat.c \
139 toys/pending/route.c \
143 toys/pending/traceroute.c \
144 toys/posix/basename.c \
157 toys/posix/dirname.c \
161 toys/posix/expand.c \
171 toys/posix/mkfifo.c \
178 toys/posix/printf.c \
180 toys/posix/renice.c \
187 toys/posix/strings.c \
202 -Wno-char-subscripts \
204 -Wno-string-plus-int \
206 -Wno-unused-parameter \
208 -ffunction-sections -fdata-sections \
209 -fno-asynchronous-unwind-tables \
211 toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
212 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
216 LOCAL_SHARED_LIBRARIES := libcutils libselinux
218 # This doesn't actually prevent us from dragging in libc++ at runtime
219 # because libnetd_client.so is C++.
220 LOCAL_CXX_STL := none
222 LOCAL_MODULE := toybox
224 # dupes: dd df du ls renice
225 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
226 # partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
227 # prefer BSD netcat instead?: nc netcat
228 # prefer efs2progs instead?: blkid chattr lsattr
349 # Install the symlinks.
350 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
352 include $(BUILD_EXECUTABLE)