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 := \ |
Andreas Gampe | 3294ad1 | 2015-07-30 11:46:30 -0700 | [diff] [blame] | 5 | -Werror -Wno-unused-parameter -Wno-unused-const-variable \ |
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 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 27 | |
| 28 | include $(CLEAR_VARS) |
| 29 | |
| 30 | BSD_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 31 | dd \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 32 | |
| 33 | OUR_TOOLS := \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 34 | getevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 35 | iftop \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 36 | ioctl \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 37 | log \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 38 | nandread \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 39 | newfs_msdos \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 40 | ps \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 41 | sendevent \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 42 | start \ |
| 43 | stop \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 44 | top \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 45 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 46 | ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS) |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 47 | |
| 48 | LOCAL_SRC_FILES := \ |
Elliott Hughes | 6e83c3d | 2015-06-05 16:43:23 -0700 | [diff] [blame] | 49 | start_stop.cpp \ |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 50 | toolbox.c \ |
Elliott Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 51 | $(patsubst %,%.c,$(OUR_TOOLS)) \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 52 | |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 53 | LOCAL_CFLAGS += $(common_cflags) |
Elliott Hughes | 6e83c3d | 2015-06-05 16:43:23 -0700 | [diff] [blame] | 54 | LOCAL_CONLYFLAGS += -std=gnu99 |
Elliott Hughes | ccecf14 | 2014-01-16 10:53:11 -0800 | [diff] [blame] | 55 | |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 56 | LOCAL_SHARED_LIBRARIES := \ |
Dimitry Ivanov | 0bb350a | 2016-02-12 16:39:09 -0800 | [diff] [blame] | 57 | liblog \ |
Elliott Hughes | 7fc4712 | 2014-06-07 21:53:04 -0700 | [diff] [blame] | 58 | libcutils \ |
| 59 | libselinux \ |
| 60 | |
Elliott Hughes | fd4c6b0 | 2014-07-22 17:20:15 -0700 | [diff] [blame] | 61 | LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS)) |
Elliott Hughes | 5054c0d | 2014-07-22 10:46:15 -0700 | [diff] [blame] | 62 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 63 | LOCAL_MODULE := toolbox |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 64 | |
Ying Wang | 7d45be0 | 2014-11-24 12:40:32 -0800 | [diff] [blame] | 65 | # Install the symlinks. |
| 66 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toolbox $(TARGET_OUT)/bin/$(t);) |
| 67 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 68 | # Including this will define $(intermediates). |
| 69 | # |
| 70 | include $(BUILD_EXECUTABLE) |
| 71 | |
| 72 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 73 | |
| 74 | TOOLS_H := $(intermediates)/tools.h |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 75 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 76 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 77 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 78 | $(TOOLS_H): |
| 79 | $(transform-generated-source) |
| 80 | |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 81 | $(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h |
| 82 | |
Elliott Hughes | bd02a47 | 2016-02-08 14:09:10 -0800 | [diff] [blame] | 83 | UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input-event-codes.h |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 84 | INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h |
| 85 | $(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) |
Elliott Hughes | bd02a47 | 2016-02-08 14:09:10 -0800 | [diff] [blame] | 86 | # The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late. |
| 87 | # We copy the input path so it can't be accidentally modified later. |
| 88 | $(INPUT_H_LABELS_H): PRIVATE_UAPI_INPUT_EVENT_CODES_H := $(UAPI_INPUT_EVENT_CODES_H) |
| 89 | $(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py $(PRIVATE_UAPI_INPUT_EVENT_CODES_H) > $@ |
| 90 | # The dependency line though gets evaluated now, so the PRIVATE_ copy doesn't exist yet, |
| 91 | # and the original can't yet have been modified, so this is both sufficient and necessary. |
| 92 | $(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py $(UAPI_INPUT_EVENT_CODES_H) |
Elliott Hughes | c7f3c5c | 2015-03-25 16:40:13 -0700 | [diff] [blame] | 93 | $(INPUT_H_LABELS_H): |
| 94 | $(transform-generated-source) |
Elliott Hughes | 660e750 | 2014-08-28 20:44:20 -0700 | [diff] [blame] | 95 | |
| 96 | # We only want 'r' on userdebug and eng builds. |
| 97 | include $(CLEAR_VARS) |
| 98 | LOCAL_SRC_FILES := r.c |
| 99 | LOCAL_CFLAGS += $(common_cflags) |
| 100 | LOCAL_MODULE := r |
| 101 | LOCAL_MODULE_TAGS := debug |
Elliott Hughes | 660e750 | 2014-08-28 20:44:20 -0700 | [diff] [blame] | 102 | include $(BUILD_EXECUTABLE) |
Elliott Hughes | d20218e | 2015-02-04 18:50:14 -0800 | [diff] [blame] | 103 | |
| 104 | |
| 105 | # We build BSD grep separately, so it can provide egrep and fgrep too. |
| 106 | include $(CLEAR_VARS) |
| 107 | LOCAL_SRC_FILES := \ |
| 108 | upstream-netbsd/usr.bin/grep/fastgrep.c \ |
| 109 | upstream-netbsd/usr.bin/grep/file.c \ |
| 110 | upstream-netbsd/usr.bin/grep/grep.c \ |
| 111 | upstream-netbsd/usr.bin/grep/queue.c \ |
| 112 | upstream-netbsd/usr.bin/grep/util.c |
| 113 | LOCAL_CFLAGS += $(common_cflags) |
| 114 | LOCAL_MODULE := grep |
| 115 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);) |
| 116 | include $(BUILD_EXECUTABLE) |