| 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 | |
| Andreas Gampe | e826877 | 2014-12-04 18:01:26 -0800 | [diff] [blame] | 10 | # Temporary, remove after cleanup. b/18632512 |
| 11 | common_cflags += -Wno-unused-variable \ |
| 12 | -Wno-unused-but-set-variable |
| 13 | |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 14 | |
| 15 | include $(CLEAR_VARS) |
| 16 | LOCAL_SRC_FILES := upstream-netbsd/bin/cat/cat.c |
| 17 | LOCAL_CFLAGS += $(common_cflags) -Dmain=cat_main |
| 18 | LOCAL_MODULE := libtoolbox_cat |
| 19 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| 20 | include $(BUILD_STATIC_LIBRARY) |
| 21 | |
| 22 | include $(CLEAR_VARS) |
| 23 | LOCAL_SRC_FILES := upstream-netbsd/sbin/chown/chown.c |
| 24 | LOCAL_CFLAGS += $(common_cflags) -Dmain=chown_main |
| 25 | LOCAL_MODULE := libtoolbox_chown |
| 26 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| 27 | include $(BUILD_STATIC_LIBRARY) |
| 28 | |
| 29 | include $(CLEAR_VARS) |
| 30 | LOCAL_SRC_FILES := \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 31 | upstream-netbsd/bin/dd/args.c \ |
| 32 | upstream-netbsd/bin/dd/conv.c \ |
| 33 | upstream-netbsd/bin/dd/dd.c \ |
| 34 | upstream-netbsd/bin/dd/dd_hostops.c \ |
| 35 | upstream-netbsd/bin/dd/misc.c \ |
| 36 | upstream-netbsd/bin/dd/position.c |
| 37 | LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV |
| 38 | LOCAL_MODULE := libtoolbox_dd |
| 39 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| 40 | include $(BUILD_STATIC_LIBRARY) |
| 41 | |
| 42 | include $(CLEAR_VARS) |
| 43 | LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c |
| 44 | LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main |
| 45 | LOCAL_MODULE := libtoolbox_du |
| 46 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| 47 | include $(BUILD_STATIC_LIBRARY) |
| 48 | |
| 49 | include $(CLEAR_VARS) |
| 50 | LOCAL_SRC_FILES := \ |
| 51 | upstream-netbsd/usr.bin/grep/fastgrep.c \ |
| 52 | upstream-netbsd/usr.bin/grep/file.c \ |
| 53 | upstream-netbsd/usr.bin/grep/grep.c \ |
| 54 | upstream-netbsd/usr.bin/grep/queue.c \ |
| 55 | upstream-netbsd/usr.bin/grep/util.c |
| 56 | LOCAL_CFLAGS += $(common_cflags) -Dmain=grep_main |
| 57 | LOCAL_MODULE := libtoolbox_grep |
| 58 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| 59 | include $(BUILD_STATIC_LIBRARY) |
| 60 | |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 61 | |
| 62 | include $(CLEAR_VARS) |
| 63 | |
| 64 | BSD_TOOLS := \ |
| 65 | cat \ |
| 66 | chown \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 67 | dd \ |
| 68 | du \ |
| 69 | grep \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 70 | |
| 71 | OUR_TOOLS := \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 72 | cmp \ |
| 73 | date \ |
| 74 | df \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 75 | getevent \ |
| 76 | getprop \ |
| 77 | getsebool \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 78 | id \ |
| 79 | ifconfig \ |
| 80 | iftop \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 81 | ioctl \ |
| 82 | ionice \ |
| 83 | load_policy \ |
| 84 | log \ |
| 85 | ls \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 86 | lsof \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 87 | mount \ |
| 88 | nandread \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 89 | newfs_msdos \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 90 | notify \ |
| 91 | ps \ |
| Elliott Hughes | 0c0ab6b | 2014-11-25 11:00:41 -0800 | [diff] [blame] | 92 | prlimit \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 93 | renice \ |
| 94 | restorecon \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 95 | route \ |
| 96 | runcon \ |
| 97 | schedtop \ |
| 98 | sendevent \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 99 | setprop \ |
| 100 | setsebool \ |
| 101 | smd \ |
| 102 | start \ |
| 103 | stop \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 104 | top \ |
| 105 | touch \ |
| 106 | umount \ |
| 107 | uptime \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 108 | watchprops \ |
| 109 | wipe \ |
| Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 110 | |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 111 | ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS) |
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 112 | |
| 113 | LOCAL_SRC_FILES := \ |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 114 | upstream-netbsd/lib/libc/gen/getbsize.c \ |
| 115 | upstream-netbsd/lib/libc/gen/humanize_number.c \ |
| 116 | upstream-netbsd/lib/libc/stdlib/strsuftoll.c \ |
| 117 | upstream-netbsd/lib/libc/string/swab.c \ |
| 118 | upstream-netbsd/lib/libutil/raise_default_signal.c \ |
| 119 | dynarray.c \ |
| 120 | pwcache.c \ |
| 121 | $(patsubst %,%.c,$(OUR_TOOLS)) \ |
| 122 | toolbox.c \ |
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 123 | |
| Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 124 | LOCAL_CFLAGS += $(common_cflags) |
| Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 125 | |
| Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 126 | LOCAL_SHARED_LIBRARIES := \ |
| Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 127 | libcutils \ |
| 128 | libselinux \ |
| 129 | |
| Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 130 | LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS)) |
| Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 131 | |
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 132 | LOCAL_MODULE := toolbox |
| Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 133 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 134 | |
| Ying Wang | 7d45be0 | 2014-11-24 12:40:32 -0800 | [diff] [blame] | 135 | # Install the symlinks. |
| 136 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);) |
| 137 | |
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 138 | # Including this will define $(intermediates). |
| 139 | # |
| 140 | include $(BUILD_EXECUTABLE) |
| 141 | |
| 142 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 143 | |
| 144 | TOOLS_H := $(intermediates)/tools.h |
| Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 145 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) |
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 146 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 147 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 148 | $(TOOLS_H): |
| 149 | $(transform-generated-source) |
| 150 | |
| Elliott Hughes | 660e750 | 2014-08-28 20:44:20 -0700 | [diff] [blame] | 151 | |
| 152 | # We only want 'r' on userdebug and eng builds. |
| 153 | include $(CLEAR_VARS) |
| 154 | LOCAL_SRC_FILES := r.c |
| 155 | LOCAL_CFLAGS += $(common_cflags) |
| 156 | LOCAL_MODULE := r |
| 157 | LOCAL_MODULE_TAGS := debug |
| 158 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk |
| 159 | include $(BUILD_EXECUTABLE) |