Skip to content

Enhance makefile generation with mk lookup and WORKSPACE variable.#28

Merged
joabech merged 3 commits intoanalogdevicesinc:mainfrom
joabech:workspace-and-build-improvements
Apr 15, 2026
Merged

Enhance makefile generation with mk lookup and WORKSPACE variable.#28
joabech merged 3 commits intoanalogdevicesinc:mainfrom
joabech:workspace-and-build-improvements

Conversation

@joabech
Copy link
Copy Markdown
Contributor

@joabech joabech commented Apr 15, 2026

This adds three new features related to the build process.

  1. Support ${{ VAR }} references in sdk.yml variables section

    • Variables can now reference Make variables like $(WORKSPACE)
    • Enables workspace-relative paths without hard-coding absolute paths
    • Example: TOOLCHAIN_AARCH64_BM: ${{ WORKSPACE }}/toolchains/aarch64-bm/bin
  2. Auto-include per-git .mk fragments

    • Automatically scan build/ directory for .mk files matching git entry names (we can add more file extensions later on)
    • Provides standardized extension point without modifying sdk.yml
    • Example: build/u-boot.mk is auto-discovered and included for git named u-boot.
    • Auto-discovered fragments appear after explicit makefile_include entries
    • This is particularly helpful when we need to have intermediate makefiles that deals with more complexity than what we wants to deal with in the sdk.yml generated Makefile.
  3. Add build_folder config key for custom mk fragment lookup

    • Optional top-level build_folder key specifies where to find per-git .mk files
    • Defaults to build/ for backward compatibility if key is omitted.
    • Allows custom build folder location.

Update README.md and the copilotfile as well with information related to the changes.

joabech added 3 commits April 15, 2026 13:01
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>
@joabech joabech merged commit 98864d0 into analogdevicesinc:main Apr 15, 2026
8 checks passed
@joabech joabech deleted the workspace-and-build-improvements branch April 15, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant