blob: de8324af32a702ffc27b9296c2d035a1b2850c07 [file] [log] [blame]
Dan Willemsena852f952018-01-08 13:50:55 -08001cc_defaults {
2 name: "toolbox_defaults",
3
4 cflags: [
5 "-Werror",
6 "-Wno-unused-parameter",
7 "-Wno-unused-const-variable",
8 "-include bsd-compatibility.h",
9 ],
10 local_include_dirs: ["upstream-netbsd/include/"],
11}
Yifan Hong49641ba2017-05-22 18:08:02 -070012
13cc_library_static {
Dan Willemsena852f952018-01-08 13:50:55 -080014 name: "libtoolbox_dd",
15 defaults: ["toolbox_defaults"],
Yifan Hong49641ba2017-05-22 18:08:02 -070016 srcs: [
17 "upstream-netbsd/bin/dd/args.c",
18 "upstream-netbsd/bin/dd/conv.c",
19 "upstream-netbsd/bin/dd/dd.c",
20 "upstream-netbsd/bin/dd/dd_hostops.c",
21 "upstream-netbsd/bin/dd/misc.c",
22 "upstream-netbsd/bin/dd/position.c",
23 "upstream-netbsd/lib/libc/gen/getbsize.c",
24 "upstream-netbsd/lib/libc/gen/humanize_number.c",
25 "upstream-netbsd/lib/libc/stdlib/strsuftoll.c",
26 "upstream-netbsd/lib/libc/string/swab.c",
27 "upstream-netbsd/lib/libutil/raise_default_signal.c",
28 ],
Dan Willemsena852f952018-01-08 13:50:55 -080029 cflags: [
Yifan Hong49641ba2017-05-22 18:08:02 -070030 "-Dmain=dd_main",
31 "-DNO_CONV",
32 ],
Dan Willemsena852f952018-01-08 13:50:55 -080033}
34
35genrule {
36 name: "toolbox_tools",
37 cmd: "echo '/* file generated automatically */' >$(out) && for t in toolbox dd getevent newfs_msdos getprop; do echo \"TOOL($$t)\" >>$(out); done",
38 out: ["tools.h"],
39}
40
41genrule {
42 name: "toolbox_input_labels",
43 tool_files: ["generate-input.h-labels.py"],
44 cmd: "$(location) $(in) >$(out)",
45 srcs: [":kernel_input_headers"],
46 out: ["input.h-labels.h"],
47}
48
49cc_binary {
50 name: "toolbox",
51 defaults: ["toolbox_defaults"],
52 srcs: [
53 "toolbox.c",
54 "getevent.c",
55 "getprop.cpp",
56 "newfs_msdos.c",
57 ],
58 generated_headers: [
59 "toolbox_tools",
60 "toolbox_input_labels",
61 ],
62 whole_static_libs: ["libtoolbox_dd"],
63 shared_libs: [
64 "libbase",
65 "libcutils",
66 ],
67 static_libs: [
68 "libpropertyinfoparser",
69 ],
70 cpp_std: "gnu++1z",
71
72 symlinks: [
73 "dd",
74 "getevent",
75 "getprop",
76 "newfs_msdos",
77 ],
78}
79
80// We only want 'r' on userdebug and eng builds.
81cc_binary {
82 name: "r",
83 defaults: ["toolbox_defaults"],
84 srcs: ["r.c"],
Yifan Hong49641ba2017-05-22 18:08:02 -070085}
86
87// We build BSD grep separately, so it can provide egrep and fgrep too.
Erik Staats0c3b1bd2017-06-09 09:10:59 -070088cc_defaults {
89 name: "grep_common",
Dan Willemsena852f952018-01-08 13:50:55 -080090 defaults: ["toolbox_defaults"],
Yifan Hong49641ba2017-05-22 18:08:02 -070091 srcs: [
92 "upstream-netbsd/usr.bin/grep/fastgrep.c",
93 "upstream-netbsd/usr.bin/grep/file.c",
94 "upstream-netbsd/usr.bin/grep/grep.c",
95 "upstream-netbsd/usr.bin/grep/queue.c",
96 "upstream-netbsd/usr.bin/grep/util.c",
97 ],
Dan Willemsena852f952018-01-08 13:50:55 -080098 symlinks: [
99 "egrep",
100 "fgrep",
101 ],
Ivan Lozanof4dafbc2017-11-13 14:06:08 -0800102
103 sanitize: {
104 integer_overflow: false,
105 },
Erik Staats0c3b1bd2017-06-09 09:10:59 -0700106}
Yifan Hong49641ba2017-05-22 18:08:02 -0700107
Erik Staats0c3b1bd2017-06-09 09:10:59 -0700108cc_binary {
109 name: "grep",
110 defaults: ["grep_common"],
111}
112
113// Build vendor grep.
114// TODO: Add vendor_available to "grep" module and remove "grep_vendor" module
115// when vendor_available is fully supported.
116cc_binary {
117 name: "grep_vendor",
118 stem: "grep",
119 vendor: true,
120 defaults: ["grep_common"],
Yifan Hong49641ba2017-05-22 18:08:02 -0700121}