blob: 579d26e433609a4ca0d1e78e0155fc2e3cc39a21 [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 := \
Andreas Gampe3294ad12015-07-30 11:46:30 -07005 -Werror -Wno-unused-parameter -Wno-unused-const-variable \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07006 -I$(LOCAL_PATH)/upstream-netbsd/include/ \
Elliott Hughes5054c0d2014-07-22 10:46:15 -07007 -include bsd-compatibility.h \
8
Elliott Hughesfd4c6b02014-07-22 17:20:15 -07009
10include $(CLEAR_VARS)
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070011LOCAL_SRC_FILES := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070012 upstream-netbsd/bin/dd/args.c \
13 upstream-netbsd/bin/dd/conv.c \
14 upstream-netbsd/bin/dd/dd.c \
15 upstream-netbsd/bin/dd/dd_hostops.c \
16 upstream-netbsd/bin/dd/misc.c \
Elliott Hughesd20218e2015-02-04 18:50:14 -080017 upstream-netbsd/bin/dd/position.c \
18 upstream-netbsd/lib/libc/gen/getbsize.c \
19 upstream-netbsd/lib/libc/gen/humanize_number.c \
20 upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
21 upstream-netbsd/lib/libc/string/swab.c \
22 upstream-netbsd/lib/libutil/raise_default_signal.c
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070023LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
24LOCAL_MODULE := libtoolbox_dd
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070025include $(BUILD_STATIC_LIBRARY)
26
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070027
28include $(CLEAR_VARS)
29
30BSD_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070031 dd \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070032
33OUR_TOOLS := \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070034 df \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070035 getevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070036 iftop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070037 ioctl \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070038 log \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070039 nandread \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070040 newfs_msdos \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070041 ps \
Elliott Hughes0c0ab6b2014-11-25 11:00:41 -080042 prlimit \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070043 sendevent \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070044 start \
45 stop \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070046 top \
Stephen Smalley8290d102012-01-13 08:53:56 -050047
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070048ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
Jeff Sharkey57df14c2012-07-13 16:25:33 -070049
50LOCAL_SRC_FILES := \
Elliott Hughes6e83c3d2015-06-05 16:43:23 -070051 start_stop.cpp \
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070052 toolbox.c \
Elliott Hughesd20218e2015-02-04 18:50:14 -080053 $(patsubst %,%.c,$(OUR_TOOLS)) \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080054
Elliott Hughes5054c0d2014-07-22 10:46:15 -070055LOCAL_CFLAGS += $(common_cflags)
Elliott Hughes6e83c3d2015-06-05 16:43:23 -070056LOCAL_CONLYFLAGS += -std=gnu99
Elliott Hughesccecf142014-01-16 10:53:11 -080057
Kenny Rootb83c0982012-10-10 11:26:33 -070058LOCAL_SHARED_LIBRARIES := \
Elliott Hughes7fc47122014-06-07 21:53:04 -070059 libcutils \
60 libselinux \
61
Elliott Hughesfd4c6b02014-07-22 17:20:15 -070062LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
Elliott Hughes5054c0d2014-07-22 10:46:15 -070063
Jeff Sharkey57df14c2012-07-13 16:25:33 -070064LOCAL_MODULE := toolbox
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080065
Ying Wang7d45be02014-11-24 12:40:32 -080066# Install the symlinks.
67LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);)
68
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080069# Including this will define $(intermediates).
70#
71include $(BUILD_EXECUTABLE)
72
73$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
74
75TOOLS_H := $(intermediates)/tools.h
Jeff Sharkey57df14c2012-07-13 16:25:33 -070076$(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080077$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
78$(TOOLS_H): $(LOCAL_PATH)/Android.mk
79$(TOOLS_H):
80 $(transform-generated-source)
81
Elliott Hughesc7f3c5c2015-03-25 16:40:13 -070082$(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
83
84INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
85$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
86$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py > $@
87$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py
88$(INPUT_H_LABELS_H):
89 $(transform-generated-source)
Elliott Hughes660e7502014-08-28 20:44:20 -070090
91# We only want 'r' on userdebug and eng builds.
92include $(CLEAR_VARS)
93LOCAL_SRC_FILES := r.c
94LOCAL_CFLAGS += $(common_cflags)
95LOCAL_MODULE := r
96LOCAL_MODULE_TAGS := debug
Elliott Hughes660e7502014-08-28 20:44:20 -070097include $(BUILD_EXECUTABLE)
Elliott Hughesd20218e2015-02-04 18:50:14 -080098
99
100# We build BSD grep separately, so it can provide egrep and fgrep too.
101include $(CLEAR_VARS)
102LOCAL_SRC_FILES := \
103 upstream-netbsd/usr.bin/grep/fastgrep.c \
104 upstream-netbsd/usr.bin/grep/file.c \
105 upstream-netbsd/usr.bin/grep/grep.c \
106 upstream-netbsd/usr.bin/grep/queue.c \
107 upstream-netbsd/usr.bin/grep/util.c
108LOCAL_CFLAGS += $(common_cflags)
109LOCAL_MODULE := grep
110LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);)
111include $(BUILD_EXECUTABLE)