Skip to content

allow cargo --profile debug for simpler Makefiles #13495

Open
@lolbinarycat

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.

Metadata

Assignees

No one assigned

    Labels

    A-layoutArea: target output directory layout, naming, and organizationA-profilesArea: profilesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions