The scope of C2 language is larger than just the code itself; it also includes the build system. Including this allows doing many nice things easily, like LTO (link time optimization), etc.
The C2 build system uses two different configuration files: the recipe
and the
build file
.
Recipe
The recipe file is written by the developers and specifies which files, targets and external dependencies a project has. For very complex project with lots of configuration options, this file could be auto-generated with a 'make menuconfig' like tool. The recipe file is also used to find the top-level of a project (so it must always be placed there). The recipe file is described here.
Build file
The build file specifies where c2c needs to look for libraries, which (cross-)compiler the C-backend must use etc. This file is written by users or generated by a 3rd party build system like Yocto/Buildroot etc. The build file is optional (in contrast to the recipe that is always required). See here for details.
Calling directory
When building targets, c2c
is only called once. This way the compiler knows the
target type and all required files. Since you might be working in some subdir of your
project, c2c will iteratively search dirs to root until recipe.txt is found - no
need to change dirs to run it!
So these two calls are equal if my_project/ contains the recipe.txt:
~my_project$ c2c
~my_project/some_subdir$ c2c
Output directory
Any output will be placed in the output/ directory generated in the root directory of the project. Inside the output directory, generated files of each target will have their own folder. Therefore, to make clean just means to remove this directory.