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 |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 26 | include $(BUILD_STATIC_LIBRARY) |
| 27 | |
| 28 | include $(CLEAR_VARS) |
| 29 | LOCAL_SRC_FILES := upstream-netbsd/usr.bin/du/du.c |
| 30 | LOCAL_CFLAGS += $(common_cflags) -Dmain=du_main |
| 31 | LOCAL_MODULE := libtoolbox_du |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 32 | include $(BUILD_STATIC_LIBRARY) |
| 33 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 34 | |
| 35 | include $(CLEAR_VARS) |
| 36 | |
| 37 | BSD_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 38 | dd \ |
| 39 | du \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 40 | |
| 41 | OUR_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 42 | df \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 43 | getevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 44 | iftop \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 45 | ioctl \ |
| 46 | ionice \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 47 | log \ |
Elliott Hughes | 4652fc6 | 2015-05-16 06:28:10 +0000 | [diff] [blame] | 48 | ls \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 49 | lsof \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 50 | mount \ |
| 51 | nandread \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 52 | newfs_msdos \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 53 | ps \ |
Elliott Hughes | 0c0ab6b | 2014-11-25 11:00:41 -0800 | [diff] [blame] | 54 | prlimit \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 55 | renice \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 56 | sendevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 57 | start \ |
| 58 | stop \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 59 | top \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 60 | uptime \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 61 | watchprops \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 62 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 63 | ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS) |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 64 | |
| 65 | LOCAL_SRC_FILES := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 66 | toolbox.c \ |
Elliott Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 67 | $(patsubst %,%.c,$(OUR_TOOLS)) \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 68 | |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 69 | LOCAL_CFLAGS += $(common_cflags) |
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) |