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