examples/embedding: Build embed sources in the same make command. #16948
+65
−30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This updates the example for the embed port to streamline the build process, reducing the number of commands needed to build it from 2 to 1.
In specific:
Makefile
is moved aside to becomemakefile.mk
.Makefile
that invokesmicropython_embed.mk
andmakefile.mk
as recursive sub-makes.This indirection makes sure that the
SRC += $(wildcard $(EMBED_DIR)/*/*.c) $(wildcard $(EMBED_DIR)/*/*/*.c)
variable expansion is performed after the sources it's meant to pick up already exist. If thempy
recipe were added directly to the original makefile, these files wouldn't be picked up on first invocation and it would prevent the example from being built directly from clean.Testing
This commit updates
.github/workflows/examples.yml
to reflect theMakefile -> makefile.mk
rename, and adds tests of the combined single-command clean and build operations. I've also separately tested building the example from a number of different clean and dirty build states.Trade-offs and Alternatives
This is a documentation change (with automated tests that verify the documentation's claims).
The minor increase in technical complexity could subtly impact the example's pedagogical utility, but the positive utility of demonstrating a complete combined source-gen and compilation build should outweigh that.