blob: a0a9909aaf5ad7c1c64a5c60995cfd1a85c1ebe5 [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
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07003
Elliott Hughes5054c0d2014-07-22 10:46:15 -07004common_cflags := \
5 -std=gnu99 \
6 -Werror -Wno-unused-parameter \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07007 -I$(LOCAL_PATH)/upstream-netbsd/include/ \
Elliott Hughes5054c0d2014-07-22 10:46:15 -07008 -include bsd-compatibility.h \
9
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070010
11include $(CLEAR_VARS)
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070012LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070013 upstream-netbsd/bin/dd/args.c \
14 upstream-netbsd/bin/dd/conv.c \
15 upstream-netbsd/bin/dd/dd.c \
16 upstream-netbsd/bin/dd/dd_hostops.c \
17 upstream-netbsd/bin/dd/misc.c \
Elliott Hughesd20218e2015-02-04 18:50:14 -080018 upstream-netbsd/bin/dd/position.c \
19 upstream-netbsd/lib/libc/gen/getbsize.c \
20 upstream-netbsd/lib/libc/gen/humanize_number.c \
21 upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
22 upstream-netbsd/lib/libc/string/swab.c \
23 upstream-netbsd/lib/libutil/raise_default_signal.c
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070024LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
25LOCAL_MODULE := libtoolbox_dd
26LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
27include $(BUILD_STATIC_LIBRARY)
28
29include $(CLEAR_VARS)
30LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c
31LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main
32LOCAL_MODULE := libtoolbox_du
33LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
34include $(BUILD_STATIC_LIBRARY)
35
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070036
37include $(CLEAR_VARS)
38
39BSD_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070040 dd \
41 du \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070042
43OUR_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070044 df \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070045 getevent \
46 getprop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070047 iftop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070048 ioctl \
49 ionice \
50 load_policy \
51 log \
52 ls \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070053 lsof \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070054 mount \
55 nandread \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070056 newfs_msdos \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070057 ps \
Elliott Hughes0c0ab6b2014-11-25 11:00:41 -080058 prlimit \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070059 renice \
60 restorecon \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070061 route \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070062 sendevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070063 setprop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070064 start \
65 stop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070066 top \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070067 umount \
68 uptime \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070069 watchprops \
Stephen Smalley8290d102012-01-13 08:53:56 -050070
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070071ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
Jeff Sharkey57df14c2012-07-13 16:25:33 -070072
73LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070074 dynarray.c \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070075 toolbox.c \
Elliott Hughesd20218e2015-02-04 18:50:14 -080076 $(patsubst %,%.c,$(OUR_TOOLS)) \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080077
Elliott Hughes5054c0d2014-07-22 10:46:15 -070078LOCAL_CFLAGS += $(common_cflags)
Elliott Hughesccecf142014-01-16 10:53:11 -080079
Kenny Rootb83c0982012-10-10 11:26:33 -070080LOCAL_SHARED_LIBRARIES := \
Elliott Hughes7fc47122014-06-07 21:53:04 -070081 libcutils \
82 libselinux \
83
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070084LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
Elliott Hughes5054c0d2014-07-22 10:46:15 -070085
Jeff Sharkey57df14c2012-07-13 16:25:33 -070086LOCAL_MODULE := toolbox
Elliott Hughes7fc47122014-06-07 21:53:04 -070087LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080088
Ying Wang7d45be02014-11-24 12:40:32 -080089# Install the symlinks.
90LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
91
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080092# Including this will define $(intermediates).
93#
94include $(BUILD_EXECUTABLE)
95
96$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
97
98TOOLS_H := $(intermediates)/tools.h
Jeff Sharkey57df14c2012-07-13 16:25:33 -070099$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
101$(TOOLS_H): $(LOCAL_PATH)/Android.mk
102$(TOOLS_H):
103 $(transform-generated-source)
104
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -0700105$(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
106
107INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
108$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
109$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py > $@
110$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py
111$(INPUT_H_LABELS_H):
112 $(transform-generated-source)
Elliott Hughes660e7502014-08-28 20:44:20 -0700113
114# We only want 'r' on userdebug and eng builds.
115include $(CLEAR_VARS)
116LOCAL_SRC_FILES := r.c
117LOCAL_CFLAGS += $(common_cflags)
118LOCAL_MODULE := r
119LOCAL_MODULE_TAGS := debug
120LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
121include $(BUILD_EXECUTABLE)
Elliott Hughesd20218e2015-02-04 18:50:14 -0800122
123
124# We build BSD grep separately, so it can provide egrep and fgrep too.
125include $(CLEAR_VARS)
126LOCAL_SRC_FILES := \
127 upstream-netbsd/usr.bin/grep/fastgrep.c \
128 upstream-netbsd/usr.bin/grep/file.c \
129 upstream-netbsd/usr.bin/grep/grep.c \
130 upstream-netbsd/usr.bin/grep/queue.c \
131 upstream-netbsd/usr.bin/grep/util.c
132LOCAL_CFLAGS += $(common_cflags)
133LOCAL_MODULE := grep
134LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);)
135include $(BUILD_EXECUTABLE)