blob: e9fb201fc7d28e9a55c62a96f019f83b55c54584 [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 := upstream-netbsd/sbin/chown/chown.c
17LOCAL_CFLAGS += $(common_cflags) -Dmain=chown_main
18LOCAL_MODULE := libtoolbox_chown
19LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
20include $(BUILD_STATIC_LIBRARY)
21
22include $(CLEAR_VARS)
23LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070024 upstream-netbsd/bin/dd/args.c \
25 upstream-netbsd/bin/dd/conv.c \
26 upstream-netbsd/bin/dd/dd.c \
27 upstream-netbsd/bin/dd/dd_hostops.c \
28 upstream-netbsd/bin/dd/misc.c \
29 upstream-netbsd/bin/dd/position.c
30LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
31LOCAL_MODULE := libtoolbox_dd
32LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
33include $(BUILD_STATIC_LIBRARY)
34
35include $(CLEAR_VARS)
36LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c
37LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main
38LOCAL_MODULE := libtoolbox_du
39LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
40include $(BUILD_STATIC_LIBRARY)
41
42include $(CLEAR_VARS)
43LOCAL_SRC_FILES := \
44 upstream-netbsd/usr.bin/grep/fastgrep.c \
45 upstream-netbsd/usr.bin/grep/file.c \
46 upstream-netbsd/usr.bin/grep/grep.c \
47 upstream-netbsd/usr.bin/grep/queue.c \
48 upstream-netbsd/usr.bin/grep/util.c
49LOCAL_CFLAGS += $(common_cflags) -Dmain=grep_main
50LOCAL_MODULE := libtoolbox_grep
51LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
52include $(BUILD_STATIC_LIBRARY)
53
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070054
55include $(CLEAR_VARS)
56
57BSD_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070058 chown \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070059 dd \
60 du \
61 grep \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070062
63OUR_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070064 cmp \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070065 df \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070066 getevent \
67 getprop \
68 getsebool \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070069 id \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070070 iftop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070071 ioctl \
72 ionice \
73 load_policy \
74 log \
75 ls \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070076 lsof \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070077 mount \
78 nandread \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070079 newfs_msdos \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070080 ps \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070081 renice \
82 restorecon \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070083 route \
84 runcon \
85 schedtop \
86 sendevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070087 setprop \
88 setsebool \
89 smd \
90 start \
91 stop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070092 top \
93 touch \
94 umount \
95 uptime \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070096 watchprops \
97 wipe \
Stephen Smalley8290d102012-01-13 08:53:56 -050098
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070099ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700100
101LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -0700102 upstream-netbsd/lib/libc/gen/getbsize.c \
103 upstream-netbsd/lib/libc/gen/humanize_number.c \
104 upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
105 upstream-netbsd/lib/libc/string/swab.c \
106 upstream-netbsd/lib/libutil/raise_default_signal.c \
107 dynarray.c \
108 pwcache.c \
109 $(patsubst %,%.c,$(OUR_TOOLS)) \
110 toolbox.c \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800111
Elliott Hughes5054c0d2014-07-22 10:46:15 -0700112LOCAL_CFLAGS += $(common_cflags)
Elliott Hughesccecf142014-01-16 10:53:11 -0800113
Kenny Rootb83c0982012-10-10 11:26:33 -0700114LOCAL_SHARED_LIBRARIES := \
Elliott Hughes7fc47122014-06-07 21:53:04 -0700115 libcutils \
116 libselinux \
117
Elliott Hughesfd4c6b02014-07-22 17:20:15 -0700118LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
Elliott Hughes5054c0d2014-07-22 10:46:15 -0700119
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700120LOCAL_MODULE := toolbox
Elliott Hughes7fc47122014-06-07 21:53:04 -0700121LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800122
Ying Wang7d45be02014-11-24 12:40:32 -0800123# Install the symlinks.
124LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
125
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800126# Including this will define $(intermediates).
127#
128include $(BUILD_EXECUTABLE)
129
130$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
131
132TOOLS_H := $(intermediates)/tools.h
Jeff Sharkey57df14c2012-07-13 16:25:33 -0700133$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800134$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
135$(TOOLS_H): $(LOCAL_PATH)/Android.mk
136$(TOOLS_H):
137 $(transform-generated-source)
138
Elliott Hughes660e7502014-08-28 20:44:20 -0700139
140# We only want 'r' on userdebug and eng builds.
141include $(CLEAR_VARS)
142LOCAL_SRC_FILES := r.c
143LOCAL_CFLAGS += $(common_cflags)
144LOCAL_MODULE := r
145LOCAL_MODULE_TAGS := debug
146LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
147include $(BUILD_EXECUTABLE)