Even though, in retrospect, the API docs were always there, somehow looking at distutils innards led me in an awkward direction for the longest time. Given some source files, the actual basic use case is very simple:
from distutils.ccompiler import new_compiler
# Create compiler with default options
c = new_compiler()
workdir = "."
# Optionally add include directories etc.
# Compile into .o files
objects = c.compile(["a.c", "b.c"])
# Create static or shared library
c.create_static_lib(objects, "foo", output_dir=workdir)
c.link_shared_lib(objects, "foo", output_dir=workdir)