Andrey Butok requested to implement the following "project content definition" method which is already used by the mbedtls project.
This is a compile time configuration technique which enables the definition of what source files affect the build output based on what features are needed to be supported.
- The content of each source file need to be enclosed by a conditional compilation block. The condition is the defined state of a C macro.
- A configuration header captures all configuration macros for the software which are menat to be manually edited. Using the macros mentioned in 1. and further optional pre-processor conditions the system can define which files affect the build output and which do not.
- Uses standard tools available in any C build environment, and thus it is IDE antagonistic.
- The techniques is not really controlling the build content, just renders the excluded files act like emtpy files. As a result:
- Build tool will build files not affecting the build output, which will make the build process longer.
- The build system will have no access to this metadata.
- It is hard to extract statistics how the build output is affected by some configuration values.
- It makes the task of defining the build content split by multiple tools, which makes maintenance harder.
- This does not integrates well with GUI tools, i.e. IDEs will not be able to correctly show the status of the file.
- Code is harder to read due to ifdef block.
- The conditional block renders the file content to be dead code, which is does not play well safety and security related standards (i.e. MISRA)