build-makefile
Original:🇨🇳 Chinese
Translated
1 scripts
Used when you need to compile embedded firmware projects based on bare Makefiles (without CMake/IDE), call the built-in script to parse the Makefile, execute make, and locate firmware artifacts.
4installs
Sourceleokemp223/embed-ai-tool
Added on
NPX Install
npx skill4agent add leokemp223/embed-ai-tool build-makefileTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Build Makefile Projects
Applicable Scenarios
- specifies
Project Profile.build_system: makefile - The workspace contains /
Makefile/makefile, but noGNUmakefile,CMakeLists.txt,platformio.inior.uvprojx..ewp - Users want to compile or confirm firmware artifacts for bare Makefile MCU projects.
- New ,
ELForHEXfiles are required for flashing or debugging processes.BIN
Required Inputs
- Workspace path, or an existing .
Project Profile - Optional make target name, additional variables (e.g., ,
CROSS_COMPILE), make flags, and number of parallel tasks.MCU
Automatic Detection
- If /
Makefile/makefileexists in the workspace root directory, the script automatically identifies it.GNUmakefile - Parse Makefile variables: ,
CROSS_COMPILE,CC,TARGET,MCU,BOARD,CFLAGS, etc.LDFLAGS - Infer toolchain family from prefix (
CROSS_COMPILE→arm-none-eabi-,gnu-arm→riscv32-unknown-elf-,gnu-riscv→xtensa-esp32-elf-).gnu-esp - Infer target chip from variable,
MCUflag or linker script name.-mcpu= - Detect if /
make/gmakeis available.mingw32-make - If the Makefile contains , prompt the user to use the
# Generated by CMakeskill.build-cmake
Execution Steps
- First read references/usage.md to confirm whether this time is for environment detection, Makefile parsing, target listing, build execution, or just artifact scanning.
- If you are not sure whether the environment is ready, first run the mode of the built-in script scripts/makefile_builder.py to confirm.
--detect - Run to check the parsed variables and toolchain information, and confirm the target chip and compiler.
--parse-makefile - To view available targets, run .
--list-targets - Use to run the build, specifying
--source,--target,--cleanand--extra-argsas needed.-j - Read the build results and artifact scan report output by the script, write the artifact path back to and pass it to downstream skills.
Project Profile
Failure Diversion
- Return when
environment-missingor cross-compiler is missing.make - Return when there are Makefile syntax errors, link failures or invalid target names.
project-config-error - Return when the build is successful but no flashable artifacts are found in the source directory and
artifact-missing,build/,output/.out/ - Return when multiple top-level Makefiles exist in the workspace and the intent is unclear.
ambiguous-context
Platform Notes
- is usually pre-installed on Linux / macOS.
make - On Windows, is provided by MSYS2, MinGW or WSL. The script will try
make,make,gmakein sequence.mingw32-make - The build directory in the output should remain an absolute path for direct reuse by downstream flashing and debugging skills.
Output Conventions
- Output build commands, build directories, parsed toolchain information and preferred artifact paths.
- Update with
Project Profile,artifact_path,artifact_kindandtoolchain.target_mcu - Recommend ,
flash-openocdorflash-jlinkafter success.debug-gdb-openocd
Handover Relationships
- When the next step is to flash the program to hardware, pass the successful build result to or
flash-openocd.flash-jlink - When symbol information or a debugging session is needed for the next step, pass the successful build result to or
debug-gdb-openocd.debug-jlink