Skip to main content

PyMakeX

A Python-powered build system for MCU firmware development, built on top of SCons. Compile C/C++ source code for arm riscv, and other common microcontrollers with ease.

Features

  • Multi-Toolchain Support — Use armgcc, LLVM/Clang, or armclang to compile your firmware.
  • Modular Third-Party Integration — Pre-built modules for FreeRTOS, LVGL, FatFS, EasyLogger, CherryUSB, FreeModbus, and more.
  • Incremental Builds — Analyzes which files need rebuilding and compiles only what changed.
  • Multi-Processing Build — Parallel compilation with configurable job count (-j).
  • Ninja Backend — Optional Ninja build mode for faster builds (-n or --ninja).
  • Compilation Database — Generate compile_commands.json for IDE support and static analysis (--compiledb).
  • Build Cache — Cache compiled objects to speed up rebuilds (--cache).
  • Dry-Run Mode — Preview what would be built without actually compiling (--dry-run).
  • Party System — Organize third-party library flags and configurations in reusable "party" modules.

Installation

pip install pymakex

For development dependencies:

pip install pymakex[dev]

Quick Start

  1. Create a Makefile.py in your project root:
import pymakex

# Define your toolchain
pymakex.Toolchain("armgcc")

# Add your source files
pymakex.Sources([
    "src/main.c",
    "src/gpio.c",
    "src/uart.c",
])

# Include third-party libraries via parties
pymakex.Party("FreeRTOS")
pymakex.Party("LVGL")
pymakex.Party("FatFS")

# Build the firmware
pymakex.Program("firmware.elf")
  1. Run the build:
pymakex -f Makefile.py

CLI Usage

pymakex [options]

Options:
  -f, --file FILE      Build script to execute (default: Makefile.py)
  -j, --jobs N         Number of parallel jobs (default: 1)
  -m, --mode MODE      Build mode: ninja | build | compiledb | cache | dryrun
  -n, --ninja [update] Use Ninja build backend
  -c, --clean          Clean all build artifacts
  --compiledb          Generate compile_commands.json
  --cache [update]     Enable build cache
  --dry-run            Preview build without executing
  -s, --silent         Suppress non-error output
  --verbose            Show detailed build information
  -l, --logger LEVEL   Log level: 0=quiet, 1=verbose, 2=debug
  -t, --toml PATH      Specify TOML configuration file
  -p, --party PATH     Specify party file path
  -v, --version        Show version

Aliases

The following commands are equivalent:

pymake -f Makefile.py
pymakex -f Makefile.py
pymkx -f Makefile.py

Supported Toolchains

Toolchain Description
armgcc ARM GNU GCC Toolchain
llvm_clang LLVM/Clang for ARM
armclang ARM Compiler 6 (armclang)

Supported Third-Party Libraries (Parties)

Module Description
FreeRTOS Real-time operating system
LVGL Lightweight graphics library
FatFS FAT/exFAT file system
EasyLogger Embedded logging library
CherryUSB USB device/host stack
FreeModbus Modbus protocol stack
FreeLWIP Lightweight TCP/IP stack
HALDrivers MCU HAL drivers
STDDrivers Standard peripheral drivers

Build Workflow

  1. PyMakeX runs your Makefile.py script in a subprocess.
  2. The script defines parties, sources, targets, and build commands.
  3. Output marked with ##PYMAKE## is captured to build the task graph.
  4. The task graph is analyzed to determine which files need rebuilding.
  5. Builds are executed in parallel (when -j > 1).

License

MIT License — see the LICENSE file for details.

Metadata

Release files for PyMakeX 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for PyMakeX 0.5.2
File Interpreter ABI Platform
pymakex-0.5.2-py3-none-any.whl Python 3 none any Details

Release files / pymakex-0.5.2-py3-none-any.whl

Download URL pymakex-0.5.2-py3-none-any.whl
Size 182.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d16174667348b38b1be986bb1d49d812425502fa596d7502b696ba862802b750
BLAKE2b-256 checksum
How to use checksums
1b3cda0cf41c66c20a68b3f7974a7045c75cdf828b3abc5055725fda22068f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release history Release notifications | RSS feed

0.5.3

1 release file

This release

0.5.2 This release

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page