Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion examples/rust/hello/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ PRIORITY = $(CONFIG_EXAMPLES_HELLO_RUST_CARGO_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_HELLO_RUST_CARGO_STACKSIZE)
MODULE = $(CONFIG_EXAMPLES_HELLO_RUST_CARGO)

context::
RUST_LIB := $(call RUST_GET_BINDIR,hello,$(APPDIR)/examples/rust)
RUST_SRCS := $(call RUST_CARGO_SRCS,hello,$(APPDIR)/examples/rust)

$(RUST_LIB): $(RUST_SRCS)
$(call RUST_CARGO_BUILD,hello,$(APPDIR)/examples/rust)

context:: $(RUST_LIB)

all:: $(RUST_LIB)

clean::
$(call RUST_CARGO_CLEAN,hello,$(APPDIR)/examples/rust)

Expand Down
9 changes: 8 additions & 1 deletion examples/rust/slint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ PRIORITY = $(CONFIG_EXAMPLES_RUST_SLINT_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_RUST_SLINT_STACKSIZE)
MODULE = $(CONFIG_EXAMPLES_RUST_SLINT)

context::
RUST_LIB := $(call RUST_GET_BINDIR,slint,$(APPDIR)/examples/rust)
RUST_SRCS := $(call RUST_CARGO_SRCS,slint,$(APPDIR)/examples/rust)

$(RUST_LIB): $(RUST_SRCS)
$(call RUST_CARGO_BUILD,slint,$(APPDIR)/examples/rust)

context:: $(RUST_LIB)

all:: $(RUST_LIB)

clean::
$(call RUST_CARGO_CLEAN,slint,$(APPDIR)/examples/rust)

Expand Down
15 changes: 15 additions & 0 deletions tools/Rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,18 @@ $(2)/$(1)/target/$(strip $(if $(findstring .json,$(call RUST_TARGET_TRIPLE)), \
$(basename $(notdir $(call RUST_TARGET_TRIPLE))), \
$(call RUST_TARGET_TRIPLE)))/$(if $(CONFIG_DEBUG_FULLOPT),release,debug)/lib$(1).a
endef

# Collect crate input files for a crate
#
# Usage: $(call RUST_CARGO_SRCS,cratename,prefix)
#
# Inputs:
# cratename - Name of the Rust crate (e.g. hello)
# prefix - Path prefix to the crate (e.g. path/to/project)
#
# Output:
# List of crate input files (excluding the cargo target directory)

define RUST_CARGO_SRCS
$(shell find $(2)/$(1) -type f -not -path '$(2)/$(1)/target/*' 2>/dev/null)
endef
Loading