RIPGREP_DEPENDENCIES = host-rustc
RIPGREP_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
-RIPGREP_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(RIPGREP_CARGO_MODE)
+RIPGREP_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(RIPGREP_CARGO_BIN_SUBDIR)
RIPGREP_CARGO_OPTS = \
- $(if $(BR2_ENABLE_DEBUG),,--release) \
--target=$(RUSTC_TARGET_NAME) \
--manifest-path=$(@D)/Cargo.toml
+ifeq ($(BR2_ENABLE_DEBUG),y)
+RIPGREP_CARGO_BIN_SUBDIR = debug
+else
+RIPGREP_CARGO_OPTS += --release
+RIPGREP_CARGO_BIN_SUBDIR = release
+endif
+
define RIPGREP_BUILD_CMDS
$(TARGET_MAKE_ENV) $(RIPGREP_CARGO_ENV) \
cargo build $(RIPGREP_CARGO_OPTS)