Enhance makefile generation with mk lookup and WORKSPACE variable.#28
Merged
joabech merged 3 commits intoanalogdevicesinc:mainfrom Apr 15, 2026
Merged
Conversation
Variables defined in the sdk.yml 'variables:' section may now reference
Make variables using the manifest ${{ VAR }} syntax. The WORKSPACE Make
variable will always be defined at the top of every generated Makefile,
providing a reliable way to build workspace-relative paths without
hard-coding absolute paths. We can for example do this:
variables:
TOOLCHAIN_AARCH64_BM: ${{ WORKSPACE }}/toolchains/aarch64-bm/bin
This syntax is expanded to $(VAR) in the generated Makefile so Make can
resolve the reference at build time.
Signed-off-by: Joakim Bech <Joakim.Bech@analog.com>
When 'cim makefile' generates the workspace Makefile, automatically scan the build/ directory to discover *.mk files whose base names match the 'name' field of git entries in sdk.yml. For each matching file (e.g., build/u-boot.mk for a git named 'u-boot'), a '-include build/<name>.mk' directive is appended to the Makefile after variable declarations. This helps us defining a standardized location for build related tasks. By putting build related files into the workspace is sufficient for it to be picked up the next time 'cim makefile' runs, without any changes to sdk.yml. The auto-discovered fragments appear after explicit 'makefile_include:' entries. If no matching .mk file exists, behavior is unchanged; the git entry's 'build:' section will continue working as before. Signed-off-by: Joakim Bech <Joakim.Bech@analog.com>
Introduce an optional top-level 'build_folder' key in sdk.yml that
specifies the workspace-relative directory where per-git '<name>.mk'
files are auto-discovered when running 'cim makefile'. This was added to
make it both possible to override the default behavior that will assume
that 'build/' is used.
When the key is absent, the existing default of 'build/' will is used,
preserving full backward compatibility. When set, the supplied directory
is used exclusively; the default 'build/' directory is no longer
searched.
Example sdk.yml usage:
build_folder: some-workspace-relative-folder
gits:
- name: u-boot
...
With this configuration, 'cim makefile' will emit:
-include some-workspace-relative-folder/u-boot.mk
Signed-off-by: Joakim Bech <Joakim.Bech@analog.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds three new features related to the build process.
Support
${{ VAR }}references insdk.ymlvariables section$(WORKSPACE)TOOLCHAIN_AARCH64_BM: ${{ WORKSPACE }}/toolchains/aarch64-bm/binAuto-include per-git .mk fragments
build/directory for.mkfiles matching git entry names (we can add more file extensions later on)sdk.ymlbuild/u-boot.mkis auto-discovered and included for git namedu-boot.Add
build_folderconfig key for custom mk fragment lookupbuild_folderkey specifies where to find per-git.mkfilesbuild/for backward compatibility if key is omitted.Update README.md and the copilotfile as well with information related to the changes.