Now I have a project managed by Makefile
. That is, make run
is the entry for the project. Rust
codes, managed by Cargo
, is a part of my project.
What I want to achieve is to pass some arguments from Makefile
to Rust
codes.
I know how to achieve this in C
:
$ gcc --help | grep -- -D
-D <macro>=<value> Define <macro> to <value> (or 1 if <value> omitted)
So, I can just pass arguments from make run MYARGUMENT=xxx
and in Makefile
pass $(MYARGUMENT)
to gcc
.
How to achieve it if I want to pass MYARGUMENT
to command cargo run
?
Or, I kind of want a feature like this -- to disable some statements in Rust codes, which could be controlled from Makefile:
#ifdef XXX
printf("XXX is define!\n");
#endif