Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 1 | cc_defaults { |
| 2 | name: "toolbox_defaults", |
| 3 | |
| 4 | cflags: [ |
| 5 | "-Werror", |
| 6 | "-Wno-unused-parameter", |
| 7 | "-Wno-unused-const-variable", |
| 8 | "-include bsd-compatibility.h", |
Elliott Hughes | 16b82b7 | 2018-01-22 16:15:55 -0800 | [diff] [blame] | 9 | "-D_FILE_OFFSET_BITS=64", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 10 | ], |
| 11 | local_include_dirs: ["upstream-netbsd/include/"], |
| 12 | } |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 13 | |
| 14 | cc_library_static { |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 15 | name: "libtoolbox_dd", |
| 16 | defaults: ["toolbox_defaults"], |
Tom Cherry | 6fb3dca | 2018-01-09 13:20:08 -0800 | [diff] [blame] | 17 | vendor_available: true, |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 18 | srcs: [ |
| 19 | "upstream-netbsd/bin/dd/args.c", |
| 20 | "upstream-netbsd/bin/dd/conv.c", |
| 21 | "upstream-netbsd/bin/dd/dd.c", |
| 22 | "upstream-netbsd/bin/dd/dd_hostops.c", |
| 23 | "upstream-netbsd/bin/dd/misc.c", |
| 24 | "upstream-netbsd/bin/dd/position.c", |
| 25 | "upstream-netbsd/lib/libc/gen/getbsize.c", |
| 26 | "upstream-netbsd/lib/libc/gen/humanize_number.c", |
| 27 | "upstream-netbsd/lib/libc/stdlib/strsuftoll.c", |
| 28 | "upstream-netbsd/lib/libc/string/swab.c", |
| 29 | "upstream-netbsd/lib/libutil/raise_default_signal.c", |
| 30 | ], |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 31 | cflags: [ |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 32 | "-Dmain=dd_main", |
| 33 | "-DNO_CONV", |
| 34 | ], |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | genrule { |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 38 | name: "toolbox_input_labels", |
| 39 | tool_files: ["generate-input.h-labels.py"], |
| 40 | cmd: "$(location) $(in) >$(out)", |
| 41 | srcs: [":kernel_input_headers"], |
| 42 | out: ["input.h-labels.h"], |
| 43 | } |
| 44 | |
Tom Cherry | 6fb3dca | 2018-01-09 13:20:08 -0800 | [diff] [blame] | 45 | cc_defaults { |
| 46 | name: "toolbox_binary_defaults", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 47 | defaults: ["toolbox_defaults"], |
Tom Cherry | 91094e0 | 2018-01-02 11:50:16 -0800 | [diff] [blame] | 48 | cpp_std: "experimental", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 49 | srcs: [ |
| 50 | "toolbox.c", |
| 51 | "getevent.c", |
Tom Cherry | 91094e0 | 2018-01-02 11:50:16 -0800 | [diff] [blame] | 52 | "getprop.cpp", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 53 | "newfs_msdos.c", |
| 54 | ], |
| 55 | generated_headers: [ |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 56 | "toolbox_input_labels", |
| 57 | ], |
| 58 | whole_static_libs: ["libtoolbox_dd"], |
| 59 | shared_libs: [ |
Tom Cherry | 91094e0 | 2018-01-02 11:50:16 -0800 | [diff] [blame] | 60 | "libbase", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 61 | "libcutils", |
| 62 | ], |
Tom Cherry | 91094e0 | 2018-01-02 11:50:16 -0800 | [diff] [blame] | 63 | static_libs: ["libpropertyinfoparser"], |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 64 | |
| 65 | symlinks: [ |
| 66 | "dd", |
| 67 | "getevent", |
Tom Cherry | 91094e0 | 2018-01-02 11:50:16 -0800 | [diff] [blame] | 68 | "getprop", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 69 | "newfs_msdos", |
| 70 | ], |
| 71 | } |
| 72 | |
Tom Cherry | 6fb3dca | 2018-01-09 13:20:08 -0800 | [diff] [blame] | 73 | cc_binary { |
| 74 | name: "toolbox", |
| 75 | defaults: ["toolbox_binary_defaults"], |
| 76 | } |
| 77 | |
| 78 | cc_binary { |
| 79 | name: "toolbox_vendor", |
| 80 | stem: "toolbox", |
| 81 | vendor: true, |
| 82 | defaults: ["toolbox_binary_defaults"], |
| 83 | } |
| 84 | |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 85 | // We only want 'r' on userdebug and eng builds. |
| 86 | cc_binary { |
| 87 | name: "r", |
| 88 | defaults: ["toolbox_defaults"], |
| 89 | srcs: ["r.c"], |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | // We build BSD grep separately, so it can provide egrep and fgrep too. |
Erik Staats | 0c3b1bd | 2017-06-09 09:10:59 -0700 | [diff] [blame] | 93 | cc_defaults { |
| 94 | name: "grep_common", |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 95 | defaults: ["toolbox_defaults"], |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 96 | srcs: [ |
| 97 | "upstream-netbsd/usr.bin/grep/fastgrep.c", |
| 98 | "upstream-netbsd/usr.bin/grep/file.c", |
| 99 | "upstream-netbsd/usr.bin/grep/grep.c", |
| 100 | "upstream-netbsd/usr.bin/grep/queue.c", |
| 101 | "upstream-netbsd/usr.bin/grep/util.c", |
| 102 | ], |
Dan Willemsen | a852f95 | 2018-01-08 13:50:55 -0800 | [diff] [blame] | 103 | symlinks: [ |
| 104 | "egrep", |
| 105 | "fgrep", |
| 106 | ], |
Ivan Lozano | f4dafbc | 2017-11-13 14:06:08 -0800 | [diff] [blame] | 107 | |
| 108 | sanitize: { |
| 109 | integer_overflow: false, |
| 110 | }, |
Erik Staats | 0c3b1bd | 2017-06-09 09:10:59 -0700 | [diff] [blame] | 111 | } |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 112 | |
Erik Staats | 0c3b1bd | 2017-06-09 09:10:59 -0700 | [diff] [blame] | 113 | cc_binary { |
| 114 | name: "grep", |
| 115 | defaults: ["grep_common"], |
| 116 | } |
| 117 | |
| 118 | // Build vendor grep. |
| 119 | // TODO: Add vendor_available to "grep" module and remove "grep_vendor" module |
| 120 | // when vendor_available is fully supported. |
| 121 | cc_binary { |
| 122 | name: "grep_vendor", |
| 123 | stem: "grep", |
| 124 | vendor: true, |
| 125 | defaults: ["grep_common"], |
Yifan Hong | 49641ba | 2017-05-22 18:08:02 -0700 | [diff] [blame] | 126 | } |