blob: ddd95b207da77af75b72bac23514adf2a8bd6a6c [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",
Elliott Hughes16b82b72018-01-22 16:15:55 -08009 "-D_FILE_OFFSET_BITS=64",
Dan Willemsena852f952018-01-08 13:50:55 -080010 ],
11 local_include_dirs: ["upstream-netbsd/include/"],
12}
Yifan Hong49641ba2017-05-22 18:08:02 -070013
14cc_library_static {
Dan Willemsena852f952018-01-08 13:50:55 -080015 name: "libtoolbox_dd",
16 defaults: ["toolbox_defaults"],
Tom Cherry6fb3dca2018-01-09 13:20:08 -080017 vendor_available: true,
Yifan Hong49641ba2017-05-22 18:08:02 -070018 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 Willemsena852f952018-01-08 13:50:55 -080031 cflags: [
Yifan Hong49641ba2017-05-22 18:08:02 -070032 "-Dmain=dd_main",
33 "-DNO_CONV",
34 ],
Dan Willemsena852f952018-01-08 13:50:55 -080035}
36
37genrule {
Dan Willemsena852f952018-01-08 13:50:55 -080038 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 Cherry6fb3dca2018-01-09 13:20:08 -080045cc_defaults {
46 name: "toolbox_binary_defaults",
Dan Willemsena852f952018-01-08 13:50:55 -080047 defaults: ["toolbox_defaults"],
Tom Cherry91094e02018-01-02 11:50:16 -080048 cpp_std: "experimental",
Dan Willemsena852f952018-01-08 13:50:55 -080049 srcs: [
50 "toolbox.c",
51 "getevent.c",
Tom Cherry91094e02018-01-02 11:50:16 -080052 "getprop.cpp",
Dan Willemsena852f952018-01-08 13:50:55 -080053 "newfs_msdos.c",
54 ],
55 generated_headers: [
Dan Willemsena852f952018-01-08 13:50:55 -080056 "toolbox_input_labels",
57 ],
58 whole_static_libs: ["libtoolbox_dd"],
59 shared_libs: [
Tom Cherry91094e02018-01-02 11:50:16 -080060 "libbase",
Dan Willemsena852f952018-01-08 13:50:55 -080061 "libcutils",
62 ],
Tom Cherry91094e02018-01-02 11:50:16 -080063 static_libs: ["libpropertyinfoparser"],
Dan Willemsena852f952018-01-08 13:50:55 -080064
65 symlinks: [
66 "dd",
67 "getevent",
Tom Cherry91094e02018-01-02 11:50:16 -080068 "getprop",
Dan Willemsena852f952018-01-08 13:50:55 -080069 "newfs_msdos",
70 ],
71}
72
Tom Cherry6fb3dca2018-01-09 13:20:08 -080073cc_binary {
74 name: "toolbox",
75 defaults: ["toolbox_binary_defaults"],
76}
77
78cc_binary {
79 name: "toolbox_vendor",
80 stem: "toolbox",
81 vendor: true,
82 defaults: ["toolbox_binary_defaults"],
83}
84
Dan Willemsena852f952018-01-08 13:50:55 -080085// We only want 'r' on userdebug and eng builds.
86cc_binary {
87 name: "r",
88 defaults: ["toolbox_defaults"],
89 srcs: ["r.c"],
Yifan Hong49641ba2017-05-22 18:08:02 -070090}
91
92// We build BSD grep separately, so it can provide egrep and fgrep too.
Erik Staats0c3b1bd2017-06-09 09:10:59 -070093cc_defaults {
94 name: "grep_common",
Dan Willemsena852f952018-01-08 13:50:55 -080095 defaults: ["toolbox_defaults"],
Yifan Hong49641ba2017-05-22 18:08:02 -070096 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 Willemsena852f952018-01-08 13:50:55 -0800103 symlinks: [
104 "egrep",
105 "fgrep",
106 ],
Ivan Lozanof4dafbc2017-11-13 14:06:08 -0800107
108 sanitize: {
109 integer_overflow: false,
110 },
Erik Staats0c3b1bd2017-06-09 09:10:59 -0700111}
Yifan Hong49641ba2017-05-22 18:08:02 -0700112
Erik Staats0c3b1bd2017-06-09 09:10:59 -0700113cc_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.
121cc_binary {
122 name: "grep_vendor",
123 stem: "grep",
124 vendor: true,
125 defaults: ["grep_common"],
Yifan Hong49641ba2017-05-22 18:08:02 -0700126}