allow cargo --profile debug
for simpler Makefiles #13495
Open
Description
Problem
cargo is great for simple projects, but for more complex (eg. multi-language) projects, it is often desirable to use cargo in addition to a more general build system, such as make.
however, the way cargo outputs build directories is often difficult to configure via make, usually resulting in people writing their makefiles in a way that only works with --release
Proposed Solution
if this was implemented, configuring builds would be as simple as:
profile = debug
bin = target/$(profile)/myprogram
$(bin): src/main.rs Cargo.toml
cargo build --profile $(profile)
and then you could call either make profile=release
or make profile=debug
Notes
this already works fine for profile=release, but it throws an error when you try to build it with less optimizations:
cargo build --profile debug
error: profile name `debug` is reserved
To configure the default development profile, use the name `dev` as in [profile.dev]
See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configuring profiles.