skip to content
[readonly]

Workspaces

A workspace is a folder with a sexc.json that has workspaces in it. sexc finds it by walking up from wherever you are, so commands work from any folder inside. A lone package with no workspace above it works too.

sexc.json
{
  "name": "sexc-monorepo",
  "private": true,
  "workspaces": ["packages/*", "apps/*"],
  "cflags": ["-std=c17", "-Wall", "-Wextra", "-Werror"],
  "profiles": {
    "debug":   { "cflags": ["-g", "-O0"] },
    "release": { "cflags": ["-O2", "-DNDEBUG"] }
  }
}

ROOT FIELDS

workspaces
Globs of package folders, like ["packages/*", "apps/*"]. Any folder they match that has a sexc.json is a package.
cflags
Flags for every compile in the workspace, before each package's own.
ldflags
Flags for every link.
profiles
Named sets of cflags and ldflags: debug is used unless you pass --profile or --release.

HOW A BUILD GOES

  • Packages are ordered so each builds after what it depends on. A cycle is an error that names every package in it.
  • Every source in every package compiles at once, one compiler per CPU. Errors from parallel compiles never interleave.
  • A file recompiles when it, any header it includes, or its command line changed. Nothing else does.
  • Libraries are archived, programs linked, each only when an input changed.
  • Each source file is compiled with -DSX_PACKAGE_NAME and -DSX_PACKAGE_VERSION from its package's manifest.

OUTPUT

.sexc/out/<profile>/obj/...   objects, with .d and .cmd
.sexc/out/<profile>/lib/      lib<package>.a
.sexc/out/<profile>/bin/      programs
.sexc/out/<profile>/test/     test programs
compile_commands.json         for clangd and editors

Everything under .sexc/ can be deleted at any time; sexc clean does it.