blob: fb2c5c746e40df75abe8636a2e3072cce95d50d9 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001LOCAL_PATH:= $(call my-dir)
Elliott Hughes5054c0d2014-07-22 10:46:15 -07002
3common_cflags := \
4 -std=gnu99 \
5 -Werror -Wno-unused-parameter \
6 -include bsd-compatibility.h \
7
8include $(CLEAR_VARS)
9LOCAL_SRC_FILES := upstream-netbsd/bin/kill/kill.c
10LOCAL_CFLAGS += $(common_cflags) -Dmain=kill_main
11LOCAL_MODULE := libtoolbox_kill
12LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
13include $(BUILD_STATIC_LIBRARY)
14
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080015include $(CLEAR_VARS)
16
17TOOLS := \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080018 cat \
Elliott Hughes7fc47122014-06-07 21:53:04 -070019 chcon \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080020 chmod \
Dries Harnie2a743732010-01-18 17:44:33 +010021 chown \
Elliott Hughes7fc47122014-06-07 21:53:04 -070022 clear \
23 cmp \
24 date \
25 dd \
26 df \
27 dmesg \
28 du \
29 getenforce \
30 getevent \
31 getprop \
32 getsebool \
33 hd \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080034 id \
Elliott Hughes7fc47122014-06-07 21:53:04 -070035 ifconfig \
36 iftop \
37 insmod \
38 ioctl \
39 ionice \
Elliott Hughes7fc47122014-06-07 21:53:04 -070040 ln \
41 load_policy \
42 log \
43 ls \
44 lsmod \
45 lsof \
46 md5 \
47 mkdir \
Sujith Ramakrishnan032d4e22014-01-14 16:57:22 -080048 mknod \
Elliott Hughes7fc47122014-06-07 21:53:04 -070049 mkswap \
50 mount \
51 mv \
52 nandread \
53 netstat \
54 newfs_msdos \
Glenn Kasten38e5f072013-09-23 15:10:12 -070055 nohup \
Elliott Hughes7fc47122014-06-07 21:53:04 -070056 notify \
57 printenv \
58 ps \
59 readlink \
60 renice \
61 restorecon \
62 rm \
63 rmdir \
64 rmmod \
65 route \
66 runcon \
67 schedtop \
68 sendevent \
69 setenforce \
70 setprop \
71 setsebool \
72 sleep \
73 smd \
74 start \
75 stop \
76 swapoff \
77 swapon \
78 sync \
79 top \
80 touch \
81 umount \
Mike Lockwooda699d622010-04-09 15:27:16 -040082 uptime \
Arve Hjønnevåg7c953d02009-09-17 17:30:55 -070083 vmstat \
Elliott Hughes7fc47122014-06-07 21:53:04 -070084 watchprops \
85 wipe \
Stephen Smalley8290d102012-01-13 08:53:56 -050086
Erik Gillingb76f0ff2011-04-28 14:23:26 -070087ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
88TOOLS += r
89endif
90
Jeff Sharkey57df14c2012-07-13 16:25:33 -070091ALL_TOOLS = $(TOOLS)
92ALL_TOOLS += \
Jeff Sharkey3e8b1582012-07-13 16:37:13 -070093 cp \
Elliott Hughes5054c0d2014-07-22 10:46:15 -070094 grep \
95 kill \
Jeff Sharkey57df14c2012-07-13 16:25:33 -070096
97LOCAL_SRC_FILES := \
Elliott Hughes0b024672014-02-28 16:48:49 -080098 cp/cp.c \
99 cp/utils.c \
David 'Digit' Turnera8d1afb2011-01-06 08:39:44 +0100100 dynarray.c \
Elliott Hughes0b024672014-02-28 16:48:49 -0800101 grep/fastgrep.c \
102 grep/file.c \
103 grep/grep.c \
104 grep/queue.c \
105 grep/util.c \
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700106 $(patsubst %,%.c,$(TOOLS)) \
Elliott Hughes0b024672014-02-28 16:48:49 -0800107 toolbox.c \
108 uid_from_user.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800109
Elliott Hughes5054c0d2014-07-22 10:46:15 -0700110LOCAL_CFLAGS += $(common_cflags)
Elliott Hughesccecf142014-01-16 10:53:11 -0800111
Elliott Hughes7fc47122014-06-07 21:53:04 -0700112LOCAL_C_INCLUDES += external/openssl/include
113
Kenny Rootb83c0982012-10-10 11:26:33 -0700114LOCAL_SHARED_LIBRARIES := \
Elliott Hughes7fc47122014-06-07 21:53:04 -0700115 libcrypto \
116 libcutils \
117 libselinux \
118
119# libusbhost is only used by lsusb, and that isn't usually included in toolbox.
120# The linker strips out all the unused library code in the normal case.
121LOCAL_STATIC_LIBRARIES := \
122 libusbhost \
Stephen Smalley8290d102012-01-13 08:53:56 -0500123
Elliott Hughes5054c0d2014-07-22 10:46:15 -0700124LOCAL_WHOLE_STATIC_LIBRARIES := \
125 libtoolbox_kill \
126
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700127LOCAL_MODULE := toolbox
Elliott Hughes7fc47122014-06-07 21:53:04 -0700128LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800129
130# Including this will define $(intermediates).
131#
132include $(BUILD_EXECUTABLE)
133
134$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
135
136TOOLS_H := $(intermediates)/tools.h
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700137$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800138$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
139$(TOOLS_H): $(LOCAL_PATH)/Android.mk
140$(TOOLS_H):
141 $(transform-generated-source)
142
143# Make #!/system/bin/toolbox launchers for each tool.
144#
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700145SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS))
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800146$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE)
147$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
148 @echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
149 @mkdir -p $(dir $@)
150 @rm -rf $@
151 $(hide) ln -sf $(TOOLBOX_BINARY) $@
152
153ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
154
155# We need this so that the installed files could be picked up based on the
156# local module name
157ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
158 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)