ct-build-dynamic-library¶
Produce a shared object from a root source file with zero boilerplate¶
- Author:
- Date:
2025-11-26
- Version:
10.0.6
- Manual section:
1
- Manual group:
developers
SYNOPSIS¶
ct-build-dynamic-library SOURCE [CT-CREATE-MAKEFILE OPTIONS]
DESCRIPTION¶
ct-build-dynamic-library mirrors ct-build-static-library but targets a
shared object. The wrapper script accepts a root translation unit, walks the
dependency graph to determine the list of files that must be compiled, and then
generates + executes a Makefile configured for --dynamic library emission.
Workflow:
The first argument (
SOURCE) is treated as the umbrella implementation.ct-filelist --filter=source --style flatdiscovers every dependent source reachable fromSOURCE.ct-create-makefile --dynamicreceives the root, the discovered list, and any remaining user arguments.make -j$(ct-jobs)builds the shared object with optimal concurrency.
All flags after SOURCE are passed through to ct-create-makefile so the
same variant, compiler flag, and output directory options you already depend on
continue to work unchanged.
OPTIONS¶
SOURCERequired entry translation unit. Determines both the exported symbols and the include graph used to discover supporting files.
- Remaining options
Forwarded untouched to
ct-create-makefile. Typical examples are--variant,--cas-objdir,--bindir,--magic, and--append-LDFLAGS. Refer toct-create-makefile(1) for exhaustive documentation.
ENVIRONMENT¶
CT_JOBSOverrides the automatically computed job count for the final
makerun.ct.confSupplies defaults for variants, compiler toolchains, include paths, cache options, and shared-object specific toggles.
EXAMPLES¶
Build libcore.so with the release variant:
ct-build-dynamic-library src/core.cpp --variant=release
Emit the library into build/lib while keeping objects in build/obj:
ct-build-dynamic-library src/api.cpp \
--cas-objdir=build/obj --bindir=build/lib --append-LDFLAGS="-Wl,-rpath,$ORIGIN"
SEE ALSO¶
ct-build-static-library (1), ct-create-makefile (1), ct-filelist (1), ct-jobs (1)