Skip to content

Makefile Targets Reference

The EmbSec Kit provides a convenient Makefile wrapper around CMake commands. This reference documents all available Make targets.

Quick Start Targets

setup

One-time setup for development environment. Checks dependencies and configures for both hardware and QEMU.

make setup

This target:

  1. Verifies all required tools are installed
  2. Runs make configure for hardware
  3. Runs make configure-qemu for emulation
  4. Provides next steps guidance

help

Shows comprehensive help with all available targets (default target).

make
# or
make help

info

Displays current build configuration and CMake settings.

make info

Configuration Targets

configure

Configures the project for TM4C123GH6PM hardware using the embedded preset.

make configure

configure-qemu

Configures the project for QEMU LM3S6965 emulation.

make configure-qemu

Build Targets

build

Builds all configured targets.

make build

sdk

Builds only the EmbSec SDK library.

make sdk

labs

Builds all lab exercises.

make labs

qemu-build

Configures (if needed) and builds labs for QEMU emulation.

make qemu-build

Lab Execution Targets

qemu-<lab-name>

Runs a specific lab in QEMU emulator.

make qemu-01-buffer-overflow
make qemu-02-format-string

debug-<lab-name>

Debugs a lab with GDB.

make debug-01-buffer-overflow

exploit-<lab-name>

Debugs a lab with exploit development helpers.

make exploit-01-buffer-overflow

flash-<lab-name>

Flashes a lab to hardware device.

make flash-01-buffer-overflow

Testing Targets

test

Runs all unit tests (alias for unittest-labs).

make test

test-labs

Tests all labs in QEMU environment.

make test-labs

unittest-labs

Runs unit tests for all labs.

make unittest-labs

unittest-lab

Runs unit tests for a specific lab.

make unittest-lab LAB=01-buffer-overflow

Packaging Targets

package-labs

Creates zip packages for all labs. Packages are placed in build/packages/.

make package-labs

package-lab

Creates a zip package for a specific lab.

make package-lab LAB=01-buffer-overflow

package

Creates distribution packages using CPack.

make package

Documentation Targets

docs

Builds documentation using MkDocs.

make docs

docs-serve

Serves documentation locally at http://localhost:8000.

make docs-serve

docs-deploy

Deploys documentation to GitLab Pages.

make docs-deploy

Maintenance Targets

clean

Cleans build artifacts.

make clean

distclean

Removes entire build directory.

make distclean

format

Formats all C source and header files using clang-format.

make format

install

Installs SDK and headers.

make install

Environment Variables

Build Configuration

BUILD_DIR

Specifies the build directory for hardware builds.

BUILD_DIR=my-build make build
Default: build

BUILD_QEMU_DIR

Specifies the build directory for QEMU builds.

BUILD_QEMU_DIR=qemu-build make qemu-build
Default: build-qemu

BUILD_TYPE

Sets the CMake build type.

BUILD_TYPE=Release make configure
Default: Debug

Target Patterns

The Makefile uses pattern rules for lab-specific targets:

  • qemu-% - Run any lab in QEMU
  • debug-% - Debug any lab with GDB
  • exploit-% - Debug any lab with exploit helpers
  • flash-% - Flash any lab to hardware

Color Output

The Makefile uses color codes for better readability:

  • Yellow: Information and progress messages
  • Green: Success messages
  • Red: Error messages

To disable colors, you can pipe output through cat:

make build | cat

Common Workflows

Initial Setup and Build

make setup
make build

QEMU Development Workflow

make qemu-build
make qemu-01-buffer-overflow
make unittest-lab LAB=01-buffer-overflow

Hardware Development Workflow

make configure
make build
make flash-01-buffer-overflow

Testing Workflow

make qemu-build
make test

Package Distribution

make build
make package-labs
ls build/packages/

Error Handling

The Makefile includes error checking for:

  • Missing dependencies (cmake, arm-none-eabi-gcc, qemu-system-arm, python3)
  • Missing build directories
  • Invalid lab names
  • Missing required variables

Error messages are displayed in red with helpful suggestions.

Tips and Tricks

Parallel Builds

The underlying CMake build system supports parallel compilation. The Makefile will use CMake's default parallelism.

Verbose Output

For debugging build issues, use CMake directly with verbose flags:

cmake --build build --verbose

Custom CMake Options

For advanced configuration, use CMake directly:

cmake -B build -DCUSTOM_OPTION=value
make build

See Also