2009-03-04 04:32:55 +01:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
2014-07-22 19:46:15 +02:00
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
|
2014-07-22 19:46:15 +02:00
|
|
|
common_cflags := \
|
|
|
|
-std=gnu99 \
|
|
|
|
-Werror -Wno-unused-parameter \
|
2014-07-23 02:20:15 +02:00
|
|
|
-I$(LOCAL_PATH)/upstream-netbsd/include/ \
|
2014-07-22 19:46:15 +02:00
|
|
|
-include bsd-compatibility.h \
|
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/cat/cat.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=cat_main
|
|
|
|
LOCAL_MODULE := libtoolbox_cat
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/sbin/chown/chown.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=chown_main
|
|
|
|
LOCAL_MODULE := libtoolbox_chown
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
upstream-netbsd/bin/cp/cp.c \
|
|
|
|
upstream-netbsd/bin/cp/utils.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=cp_main
|
|
|
|
LOCAL_MODULE := libtoolbox_cp
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
upstream-netbsd/bin/dd/args.c \
|
|
|
|
upstream-netbsd/bin/dd/conv.c \
|
|
|
|
upstream-netbsd/bin/dd/dd.c \
|
|
|
|
upstream-netbsd/bin/dd/dd_hostops.c \
|
|
|
|
upstream-netbsd/bin/dd/misc.c \
|
|
|
|
upstream-netbsd/bin/dd/position.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
|
|
|
|
LOCAL_MODULE := libtoolbox_dd
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main
|
|
|
|
LOCAL_MODULE := libtoolbox_du
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
2014-08-23 05:26:23 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-freebsd/usr.bin/false/false.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=false_main
|
|
|
|
LOCAL_MODULE := libtoolbox_false
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
upstream-netbsd/usr.bin/grep/fastgrep.c \
|
|
|
|
upstream-netbsd/usr.bin/grep/file.c \
|
|
|
|
upstream-netbsd/usr.bin/grep/grep.c \
|
|
|
|
upstream-netbsd/usr.bin/grep/queue.c \
|
|
|
|
upstream-netbsd/usr.bin/grep/util.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=grep_main
|
|
|
|
LOCAL_MODULE := libtoolbox_grep
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
2014-07-22 19:46:15 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/kill/kill.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=kill_main
|
|
|
|
LOCAL_MODULE := libtoolbox_kill
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
include $(CLEAR_VARS)
|
2014-07-23 02:20:15 +02:00
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/ln/ln.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=ln_main
|
|
|
|
LOCAL_MODULE := libtoolbox_ln
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/mv/mv.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=mv_main -D__SVR4
|
|
|
|
LOCAL_MODULE := libtoolbox_mv
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/usr.bin/printenv/printenv.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=printenv_main
|
|
|
|
LOCAL_MODULE := libtoolbox_printenv
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/rm/rm.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=rm_main
|
|
|
|
LOCAL_MODULE := libtoolbox_rm
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/rmdir/rmdir.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=rmdir_main
|
|
|
|
LOCAL_MODULE := libtoolbox_rmdir
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/sleep/sleep.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=sleep_main
|
|
|
|
LOCAL_MODULE := libtoolbox_sleep
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-netbsd/bin/sync/sync.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=sync_main
|
|
|
|
LOCAL_MODULE := libtoolbox_sync
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
2014-08-23 05:26:23 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := upstream-freebsd/usr.bin/true/true.c
|
|
|
|
LOCAL_CFLAGS += $(common_cflags) -Dmain=true_main
|
|
|
|
LOCAL_MODULE := libtoolbox_true
|
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
BSD_TOOLS := \
|
|
|
|
cat \
|
|
|
|
chown \
|
|
|
|
cp \
|
|
|
|
dd \
|
|
|
|
du \
|
2014-08-23 05:26:23 +02:00
|
|
|
false \
|
2014-07-23 02:20:15 +02:00
|
|
|
grep \
|
|
|
|
kill \
|
|
|
|
ln \
|
|
|
|
mv \
|
|
|
|
printenv \
|
|
|
|
rm \
|
|
|
|
rmdir \
|
|
|
|
sleep \
|
|
|
|
sync \
|
2014-08-23 05:26:23 +02:00
|
|
|
true \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
OUR_TOOLS := \
|
|
|
|
chcon \
|
|
|
|
chmod \
|
|
|
|
clear \
|
|
|
|
cmp \
|
|
|
|
date \
|
|
|
|
df \
|
|
|
|
dmesg \
|
|
|
|
getenforce \
|
|
|
|
getevent \
|
|
|
|
getprop \
|
|
|
|
getsebool \
|
|
|
|
hd \
|
|
|
|
id \
|
|
|
|
ifconfig \
|
|
|
|
iftop \
|
|
|
|
insmod \
|
|
|
|
ioctl \
|
|
|
|
ionice \
|
|
|
|
load_policy \
|
|
|
|
log \
|
|
|
|
ls \
|
|
|
|
lsmod \
|
|
|
|
lsof \
|
|
|
|
md5 \
|
|
|
|
mkdir \
|
|
|
|
mknod \
|
|
|
|
mkswap \
|
|
|
|
mount \
|
|
|
|
nandread \
|
|
|
|
netstat \
|
|
|
|
newfs_msdos \
|
|
|
|
nohup \
|
|
|
|
notify \
|
|
|
|
ps \
|
|
|
|
readlink \
|
|
|
|
renice \
|
|
|
|
restorecon \
|
|
|
|
rmmod \
|
|
|
|
route \
|
|
|
|
runcon \
|
|
|
|
schedtop \
|
|
|
|
sendevent \
|
|
|
|
setenforce \
|
|
|
|
setprop \
|
|
|
|
setsebool \
|
|
|
|
smd \
|
|
|
|
start \
|
|
|
|
stop \
|
|
|
|
swapoff \
|
|
|
|
swapon \
|
|
|
|
top \
|
|
|
|
touch \
|
|
|
|
umount \
|
|
|
|
uptime \
|
|
|
|
vmstat \
|
|
|
|
watchprops \
|
|
|
|
wipe \
|
2012-01-13 14:53:56 +01:00
|
|
|
|
2011-04-28 23:23:26 +02:00
|
|
|
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
2014-07-23 02:20:15 +02:00
|
|
|
OUR_TOOLS += r
|
2011-04-28 23:23:26 +02:00
|
|
|
endif
|
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
|
2012-07-14 01:25:33 +02:00
|
|
|
|
|
|
|
LOCAL_SRC_FILES := \
|
2014-07-23 02:20:15 +02:00
|
|
|
upstream-netbsd/lib/libc/gen/getbsize.c \
|
|
|
|
upstream-netbsd/lib/libc/gen/humanize_number.c \
|
|
|
|
upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
|
|
|
|
upstream-netbsd/lib/libc/string/swab.c \
|
|
|
|
upstream-netbsd/lib/libutil/raise_default_signal.c \
|
|
|
|
dynarray.c \
|
|
|
|
pwcache.c \
|
|
|
|
$(patsubst %,%.c,$(OUR_TOOLS)) \
|
|
|
|
toolbox.c \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2014-07-22 19:46:15 +02:00
|
|
|
LOCAL_CFLAGS += $(common_cflags)
|
2014-01-16 19:53:11 +01:00
|
|
|
|
2014-06-08 06:53:04 +02:00
|
|
|
LOCAL_C_INCLUDES += external/openssl/include
|
|
|
|
|
2012-10-10 20:26:33 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := \
|
2014-06-08 06:53:04 +02:00
|
|
|
libcrypto \
|
|
|
|
libcutils \
|
|
|
|
libselinux \
|
|
|
|
|
|
|
|
# libusbhost is only used by lsusb, and that isn't usually included in toolbox.
|
|
|
|
# The linker strips out all the unused library code in the normal case.
|
|
|
|
LOCAL_STATIC_LIBRARIES := \
|
|
|
|
libusbhost \
|
2012-01-13 14:53:56 +01:00
|
|
|
|
2014-07-23 02:20:15 +02:00
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
|
2014-07-22 19:46:15 +02:00
|
|
|
|
2012-07-14 01:25:33 +02:00
|
|
|
LOCAL_MODULE := toolbox
|
2014-06-08 06:53:04 +02:00
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
|
2009-03-04 04:32:55 +01:00
|
|
|
|
|
|
|
# Including this will define $(intermediates).
|
|
|
|
#
|
|
|
|
include $(BUILD_EXECUTABLE)
|
|
|
|
|
|
|
|
$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
|
|
|
|
|
|
|
|
TOOLS_H := $(intermediates)/tools.h
|
2012-07-14 01:25:33 +02:00
|
|
|
$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
|
2009-03-04 04:32:55 +01:00
|
|
|
$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
|
|
|
|
$(TOOLS_H): $(LOCAL_PATH)/Android.mk
|
|
|
|
$(TOOLS_H):
|
|
|
|
$(transform-generated-source)
|
|
|
|
|
2014-08-23 05:26:23 +02:00
|
|
|
# Make symbolic link launchers for each tool.
|
2012-07-14 01:25:33 +02:00
|
|
|
SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS))
|
2009-03-04 04:32:55 +01:00
|
|
|
$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE)
|
|
|
|
$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
|
|
|
|
@echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@rm -rf $@
|
|
|
|
$(hide) ln -sf $(TOOLBOX_BINARY) $@
|
|
|
|
|
|
|
|
ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
|
|
|
|
|
|
|
|
# We need this so that the installed files could be picked up based on the
|
|
|
|
# local module name
|
|
|
|
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
|
|
|
|
$(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
|