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:master # Push directly, avoiding 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 \
91 toys/other/freeramdisk.c \
92 toys/other/fsfreeze.c \
94 toys/other/hwclock.c \
95 toys/other/ifconfig.c \
96 toys/other/inotifyd.c \
99 toys/other/losetup.c \
100 toys/other/lsattr.c \
103 toys/other/makedevs.c \
104 toys/other/mkswap.c \
105 toys/other/modinfo.c \
106 toys/other/mountpoint.c \
107 toys/other/nbd_client.c \
108 toys/other/netcat.c \
109 toys/other/partprobe.c \
110 toys/other/pivot_root.c \
112 toys/other/printenv.c \
114 toys/other/readlink.c \
115 toys/other/realpath.c \
117 toys/other/rfkill.c \
119 toys/other/setsid.c \
121 toys/other/swapoff.c \
122 toys/other/swapon.c \
123 toys/other/switch_root.c \
124 toys/other/sysctl.c \
126 toys/other/taskset.c \
127 toys/other/timeout.c \
128 toys/other/truncate.c \
129 toys/other/uptime.c \
130 toys/other/usleep.c \
131 toys/other/vconfig.c \
132 toys/other/vmstat.c \
137 toys/pending/expr.c \
138 toys/pending/lsof.c \
139 toys/pending/more.c \
140 toys/pending/pgrep.c \
141 toys/pending/netstat.c \
142 toys/pending/route.c \
146 toys/pending/traceroute.c \
147 toys/posix/basename.c \
160 toys/posix/dirname.c \
164 toys/posix/expand.c \
174 toys/posix/mkfifo.c \
181 toys/posix/printf.c \
183 toys/posix/renice.c \
190 toys/posix/strings.c \
205 -Wno-char-subscripts \
207 -Wno-string-plus-int \
209 -Wno-unused-parameter \
211 -ffunction-sections -fdata-sections \
212 -fno-asynchronous-unwind-tables \
214 toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
215 LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"'
219 LOCAL_SHARED_LIBRARIES := libcutils libselinux
221 # This doesn't actually prevent us from dragging in libc++ at runtime
222 # because libnetd_client.so is C++.
223 LOCAL_CXX_STL := none
225 LOCAL_MODULE := toybox
228 # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client
229 # partprobe pivot_root pwdx rev rfkill switch_root vconfig
230 # prefer BSD netcat instead?: nc netcat
231 # prefer efs2progs instead?: blkid chattr lsattr
363 # Install the symlinks.
364 LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
366 include $(BUILD_EXECUTABLE)