Android.mk revision 032d4e298b0eb8e55e9963c7f3699acc30527c85
1LOCAL_PATH:= $(call my-dir) 2include $(CLEAR_VARS) 3 4TOOLS := \ 5 cat \ 6 chcon \ 7 chmod \ 8 chown \ 9 clear \ 10 cmp \ 11 date \ 12 dd \ 13 df \ 14 dmesg \ 15 du \ 16 getenforce \ 17 getevent \ 18 getprop \ 19 getsebool \ 20 hd \ 21 id \ 22 ifconfig \ 23 iftop \ 24 insmod \ 25 ioctl \ 26 ionice \ 27 kill \ 28 ln \ 29 load_policy \ 30 log \ 31 ls \ 32 lsmod \ 33 lsof \ 34 md5 \ 35 mkdir \ 36 mknod \ 37 mkswap \ 38 mount \ 39 mv \ 40 nandread \ 41 netstat \ 42 newfs_msdos \ 43 nohup \ 44 notify \ 45 printenv \ 46 ps \ 47 readlink \ 48 renice \ 49 restorecon \ 50 rm \ 51 rmdir \ 52 rmmod \ 53 route \ 54 runcon \ 55 schedtop \ 56 sendevent \ 57 setenforce \ 58 setprop \ 59 setsebool \ 60 sleep \ 61 smd \ 62 start \ 63 stop \ 64 swapoff \ 65 swapon \ 66 sync \ 67 top \ 68 touch \ 69 umount \ 70 uptime \ 71 vmstat \ 72 watchprops \ 73 wipe \ 74 75ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 76TOOLS += r 77endif 78 79ALL_TOOLS = $(TOOLS) 80ALL_TOOLS += \ 81 cp \ 82 grep 83 84LOCAL_SRC_FILES := \ 85 cp/cp.c \ 86 cp/utils.c \ 87 dynarray.c \ 88 grep/fastgrep.c \ 89 grep/file.c \ 90 grep/grep.c \ 91 grep/queue.c \ 92 grep/util.c \ 93 $(patsubst %,%.c,$(TOOLS)) \ 94 toolbox.c \ 95 uid_from_user.c \ 96 97LOCAL_CFLAGS += \ 98 -std=gnu99 \ 99 -Werror -Wno-unused-parameter \ 100 -include bsd-compatibility.h \ 101 102LOCAL_C_INCLUDES += external/openssl/include 103 104LOCAL_SHARED_LIBRARIES := \ 105 libcrypto \ 106 libcutils \ 107 libselinux \ 108 109# libusbhost is only used by lsusb, and that isn't usually included in toolbox. 110# The linker strips out all the unused library code in the normal case. 111LOCAL_STATIC_LIBRARIES := \ 112 libusbhost \ 113 114LOCAL_MODULE := toolbox 115LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk 116 117# Including this will define $(intermediates). 118# 119include $(BUILD_EXECUTABLE) 120 121$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h 122 123TOOLS_H := $(intermediates)/tools.h 124$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) 125$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done 126$(TOOLS_H): $(LOCAL_PATH)/Android.mk 127$(TOOLS_H): 128 $(transform-generated-source) 129 130# Make #!/system/bin/toolbox launchers for each tool. 131# 132SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS)) 133$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) 134$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk 135 @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" 136 @mkdir -p $(dir $@) 137 @rm -rf $@ 138 $(hide) ln -sf $(TOOLBOX_BINARY) $@ 139 140ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) 141 142# We need this so that the installed files could be picked up based on the 143# local module name 144ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ 145 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) 146