blob: f0eec687ceb589a6791f014986878b3a6a9bbb59 [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
Andreas Gampee8268772014-12-04 18:01:26 -080010# Temporary, remove after cleanup. b/18632512
11common_cflags += -Wno-unused-variable \
12 -Wno-unused-but-set-variable
13
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070014
15include $(CLEAR_VARS)
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070016LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070017 upstream-netbsd/bin/dd/args.c \
18 upstream-netbsd/bin/dd/conv.c \
19 upstream-netbsd/bin/dd/dd.c \
20 upstream-netbsd/bin/dd/dd_hostops.c \
21 upstream-netbsd/bin/dd/misc.c \
22 upstream-netbsd/bin/dd/position.c
23LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
24LOCAL_MODULE := libtoolbox_dd
25LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
26include $(BUILD_STATIC_LIBRARY)
27
28include $(CLEAR_VARS)
29LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c
30LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main
31LOCAL_MODULE := libtoolbox_du
32LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
33include $(BUILD_STATIC_LIBRARY)
34
35include $(CLEAR_VARS)
36LOCAL_SRC_FILES := \
37 upstream-netbsd/usr.bin/grep/fastgrep.c \
38 upstream-netbsd/usr.bin/grep/file.c \
39 upstream-netbsd/usr.bin/grep/grep.c \
40 upstream-netbsd/usr.bin/grep/queue.c \
41 upstream-netbsd/usr.bin/grep/util.c
42LOCAL_CFLAGS += $(common_cflags) -Dmain=grep_main
43LOCAL_MODULE := libtoolbox_grep
44LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
45include $(BUILD_STATIC_LIBRARY)
46
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070047
48include $(CLEAR_VARS)
49
50BSD_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070051 dd \
52 du \
53 grep \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070054
55OUR_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070056 df \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070057 getevent \
58 getprop \
59 getsebool \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070060 iftop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070061 ioctl \
62 ionice \
63 load_policy \
64 log \
65 ls \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070066 lsof \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070067 mount \
68 nandread \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070069 newfs_msdos \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070070 ps \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070071 renice \
72 restorecon \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070073 route \
74 runcon \
75 schedtop \
76 sendevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070077 setprop \
78 setsebool \
79 smd \
80 start \
81 stop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070082 top \
83 touch \
84 umount \
85 uptime \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070086 watchprops \
87 wipe \
Stephen Smalley8290d102012-01-13 08:53:56 -050088
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070089ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
Jeff Sharkey57df14c2012-07-13 16:25:33 -070090
91LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070092 upstream-netbsd/lib/libc/gen/getbsize.c \
93 upstream-netbsd/lib/libc/gen/humanize_number.c \
94 upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
95 upstream-netbsd/lib/libc/string/swab.c \
96 upstream-netbsd/lib/libutil/raise_default_signal.c \
97 dynarray.c \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070098 $(patsubst %,%.c,$(OUR_TOOLS)) \
99 toolbox.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100
Elliott Hughes5054c0d2014-07-22 10:46:15 -0700101LOCAL_CFLAGS += $(common_cflags)
Elliott Hughesccecf142014-01-16 10:53:11 -0800102
Kenny Rootb83c0982012-10-10 11:26:33 -0700103LOCAL_SHARED_LIBRARIES := \
Elliott Hughes7fc47122014-06-07 21:53:04 -0700104 libcutils \
105 libselinux \
106
Elliott Hughesfd4c6b02014-07-22 17:20:15 -0700107LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
Elliott Hughes5054c0d2014-07-22 10:46:15 -0700108
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700109LOCAL_MODULE := toolbox
Elliott Hughes7fc47122014-06-07 21:53:04 -0700110LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800111
Ying Wang7d45be02014-11-24 12:40:32 -0800112# Install the symlinks.
113LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
114
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800115# Including this will define $(intermediates).
116#
117include $(BUILD_EXECUTABLE)
118
119$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
120
121TOOLS_H := $(intermediates)/tools.h
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700122$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800123$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
124$(TOOLS_H): $(LOCAL_PATH)/Android.mk
125$(TOOLS_H):
126 $(transform-generated-source)
127
Elliott Hughes660e7502014-08-28 20:44:20 -0700128
129# We only want 'r' on userdebug and eng builds.
130include $(CLEAR_VARS)
131LOCAL_SRC_FILES := r.c
132LOCAL_CFLAGS += $(common_cflags)
133LOCAL_MODULE := r
134LOCAL_MODULE_TAGS := debug
135LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
136include $(BUILD_EXECUTABLE)