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