Skip to content

Build System

Overview

The build system uses GNU Make with a two-level hierarchy:

  1. Root Makefile orchestrates all module builds
  2. Per-module Makefiles standalone, can build independently

Build Targets

Target Description Flags
make all Build all modules -O3 -march=native
make release Production build -O3 -DNDEBUG
make debug Debug build -O0 -g -DDEBUG
make perf Profiling build -pg -DPERF_INSTRUMENTED
make clean Remove all artifacts
make test Run all verification tests
make lint Static analysis (cppcheck + clang-tidy)
make format Check formatting (clang-format)
make format-fix Apply formatting fixes

Compiler Flags

C11 Modules (Embedded, Protocol Codecs)

CFLAGS := -Wall -Wextra -Werror -std=c11 -O3 -march=native -fno-exceptions

C++20 Modules (High-Performance Networking)

CXXFLAGS := -Wall -Wextra -Werror -std=c++20 -O3 -march=native -fno-rtti

Rationale for Each Flag

Flag Purpose
-Wall -Wextra Enable comprehensive warnings
-Werror Treat all warnings as errors (zero-tolerance)
-O3 Maximum optimization (loop unrolling, vectorization)
-march=native Target current CPU (AVX, SSE, etc.)
-fno-exceptions No C++ exception overhead
-fno-rtti No Run-Time Type Information overhead
-std=c11 C11 atomics, _Static_assert, alignas

Per-Module Build

Each module can be built independently:

# Build a single module
make -C src/aerospace/arinc429

# Build with custom flags
make -C src/concurrency/ring_buffer CFLAGS="-O0 -g -fsanitize=thread"

# Cross-compile for ARM
make -C src/embedded/uart CC=aarch64-linux-gnu-gcc

Build Artifacts

All binaries go to build/ in the repository root:

build/
├── arinc429_demo          # ARINC 429 codec verification
├── afdx_demo              # AFDX frame build/parse test
├── arinc615a_demo         # Data loader protocol test
├── ring_buffer_demo       # SPSC ring buffer benchmark
├── spsc_queue_demo        # Zero-copy queue benchmark
├── memory_pool_demo       # Lock-free allocator test
├── epoll_reactor_demo     # Event loop test
├── raw_socket_demo        # AF_PACKET loopback test
├── uart_demo              # Serial PTY loopback test
├── spi_demo               # SPI device access test
├── i2c_demo               # I2C bus scan
├── can_demo               # CAN/CAN-FD loopback test
├── gpio_demo              # GPIO chardev test
└── modbus_demo            # Modbus RTU/TCP codec test

Prerequisites

Ubuntu/Debian

sudo apt-get update && sudo apt-get install -y \
    build-essential gcc g++ make \
    linux-headers-$(uname -r) \
    libcap-dev \
    can-utils \
    i2c-tools \
    spi-tools \
    cppcheck \
    clang-tidy \
    clang-format

RHEL/CentOS

sudo dnf groupinstall "Development Tools"
sudo dnf install kernel-devel libcap-devel

CI/CD Integration

# GitHub Actions example
name: Build & Test
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: sudo apt-get install -y build-essential linux-headers-$(uname -r)
      - name: Build all modules
        run: make all
      - name: Run tests
        run: make test
      - name: Static analysis
        run: make lint