Getting Error variable not defined while sending cc_library's name as argument to python file demo.py through cmd defined in genrule.

I want to pass cc_library's name(string) as argument to python file demo.py through cmd in defined in genrule. When cc_library with name "one" is chosen during compilation, string "one" should be sent as argument in genrule.

I am currently using $(name) to achieve this.

But error is thrown: $(name) not defined. Please let me solution to this

Code snippet:

cc_library(
name = "one",
srcs = \[...\],
)

cc_library(
name = "two",
srcs = \[...\],
)

genrule(
name = "generate_mapper",
srcs = \[...\],
outs = \[...\],
cmd = " --mode $(name)",
tools = \[":parser"\],
)

py_binary(
name = "parser",
srcs = \[
"code_gen/demo.py"\],
)
0

There are 0 best solutions below