The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 2 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 3 | |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 4 | common_cflags := \ |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 5 | -Werror -Wno-unused-parameter \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 6 | -I$(LOCAL_PATH)/upstream-netbsd/include/ \ |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 7 | -include bsd-compatibility.h \ |
| 8 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 9 | |
| 10 | include $(CLEAR_VARS) |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 11 | LOCAL_SRC_FILES := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 12 | 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 Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 17 | 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 Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 23 | LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV |
| 24 | LOCAL_MODULE := libtoolbox_dd |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 25 | include $(BUILD_STATIC_LIBRARY) |
| 26 | |
| 27 | include $(CLEAR_VARS) |
| 28 | LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c |
| 29 | LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main |
| 30 | LOCAL_MODULE := libtoolbox_du |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 31 | include $(BUILD_STATIC_LIBRARY) |
| 32 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 33 | |
| 34 | include $(CLEAR_VARS) |
| 35 | |
| 36 | BSD_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 37 | dd \ |
| 38 | du \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 39 | |
| 40 | OUR_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 41 | df \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 42 | getevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 43 | iftop \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 44 | ioctl \ |
| 45 | ionice \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 46 | log \ |
Elliott Hughes | 88f0f4b | 2015-05-16 06:28:10 +0000 | [diff] [blame] | 47 | ls \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 48 | lsof \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 49 | nandread \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 50 | newfs_msdos \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 51 | ps \ |
Elliott Hughes | 0c0ab6b | 2014-11-25 11:00:41 -0800 | [diff] [blame] | 52 | prlimit \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 53 | renice \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 54 | sendevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 55 | start \ |
| 56 | stop \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 57 | top \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 58 | uptime \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 59 | watchprops \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 60 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 61 | ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS) |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 62 | |
| 63 | LOCAL_SRC_FILES := \ |
Elliott Hughes | 6e83c3d | 2015-06-05 16:43:23 -0700 | [diff] [blame] | 64 | start_stop.cpp \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 65 | toolbox.c \ |
Elliott Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 66 | $(patsubst %,%.c,$(OUR_TOOLS)) \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 67 | |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 68 | LOCAL_CFLAGS += $(common_cflags) |
Elliott Hughes | 6e83c3d | 2015-06-05 16:43:23 -0700 | [diff] [blame] | 69 | LOCAL_CONLYFLAGS += -std=gnu99 |
Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 70 | |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 71 | LOCAL_SHARED_LIBRARIES := \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 72 | libcutils \ |
| 73 | libselinux \ |
| 74 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 75 | LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS)) |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 76 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 77 | LOCAL_MODULE := toolbox |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 78 | |
Ying Wang | 7d45be0 | 2014-11-24 12:40:32 -0800 | [diff] [blame] | 79 | # Install the symlinks. |
| 80 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);) |
| 81 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 82 | # Including this will define $(intermediates). |
| 83 | # |
| 84 | include $(BUILD_EXECUTABLE) |
| 85 | |
| 86 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 87 | |
| 88 | TOOLS_H := $(intermediates)/tools.h |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 89 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 90 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 91 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 92 | $(TOOLS_H): |
| 93 | $(transform-generated-source) |
| 94 | |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 95 | $(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h |
| 96 | |
| 97 | INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h |
| 98 | $(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) |
| 99 | $(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py > $@ |
| 100 | $(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py |
| 101 | $(INPUT_H_LABELS_H): |
| 102 | $(transform-generated-source) |
Elliott Hughes | 660e750 | 2014-08-28 20:44:20 -0700 | [diff] [blame] | 103 | |
| 104 | # We only want 'r' on userdebug and eng builds. |
| 105 | include $(CLEAR_VARS) |
| 106 | LOCAL_SRC_FILES := r.c |
| 107 | LOCAL_CFLAGS += $(common_cflags) |
| 108 | LOCAL_MODULE := r |
| 109 | LOCAL_MODULE_TAGS := debug |
Elliott Hughes | 660e750 | 2014-08-28 20:44:20 -0700 | [diff] [blame] | 110 | include $(BUILD_EXECUTABLE) |
Elliott Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 111 | |
| 112 | |
| 113 | # We build BSD grep separately, so it can provide egrep and fgrep too. |
| 114 | include $(CLEAR_VARS) |
| 115 | LOCAL_SRC_FILES := \ |
| 116 | upstream-netbsd/usr.bin/grep/fastgrep.c \ |
| 117 | upstream-netbsd/usr.bin/grep/file.c \ |
| 118 | upstream-netbsd/usr.bin/grep/grep.c \ |
| 119 | upstream-netbsd/usr.bin/grep/queue.c \ |
| 120 | upstream-netbsd/usr.bin/grep/util.c |
| 121 | LOCAL_CFLAGS += $(common_cflags) |
| 122 | LOCAL_MODULE := grep |
| 123 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);) |
| 124 | include $(BUILD_EXECUTABLE) |