xref: /llvm-project/libc/docs/dev/cmake_build_rules.rst (revision 282798fefdafc2c86bcc70c66d764d6b09fc6cb9)
1.. _cmake_build_rules:
2
3===========================
4The libc CMake build system
5===========================
6
7At the cost of verbosity, we want to keep the build system of LLVM libc
8as simple as possible. We also want to be highly modular with our build
9targets. This makes picking and choosing desired pieces a straightforward
10task.
11
12Targets for entrypoints
13-----------------------
14
15Every entrypoint in LLVM-libc has its own build target. This target is listed
16using the ``add_entrypoint_object`` rule. This rule generates a single object
17file containing the implementation of the entrypoint.
18
19Targets for redirecting entrypoints are also listed using the
20``add_entrypoint_object`` rule. However, one will have to additionally specify
21the ``REDIRECTED`` option with the rule.
22
23Targets for entrypoint libraries
24--------------------------------
25
26Standards like POSIX require that a libc provide certain library files like
27``libc.a``, ``libm.a``, etc. The targets for such library files are listed in
28the ``lib`` directory as ``add_entrypoint_library`` targets. An
29``add_entrypoint_library`` target  takes a list of ``add_entrypoint_object``
30targets and produces a static library containing the object files corresponding
31to the ``add_entrypoint_targets``.
32