mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
apps/rust: Add dependencies for Rust cargo in make builds
Add a Rust make helper that collects crate input files, and use it for the Rust hello and slint examples. This makes the generated Rust static libraries depend on the crate sources, manifests, build scripts. Hook the libraries into both context and all, so re-running make after editing Rust inputs rebuilds the crate. Signed-off-by: Shoji Tokunaga <toku@mac.com>
This commit is contained in:
parent
97802bd9e0
commit
e03e7a1890
3 changed files with 31 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue