Although build systems control what code gets compiled into the final built product, they are often overlooked when studying software variability. The Linux kernel is one of the biggest open source software systems supporting variability and contains over 10,000 configurable features described in its KCONFIG files. To understand the role of the build system in variability implementation, we use Linux as a case study. We study its build system, KBUILD, and extract the variability constraints in its Makefiles. We show that almost 50% of the configurable features in Linux control the compilation of code files in the build system. We use the extracted constraints to detect variability anomalies in the form of dead and undead code files and code blocks. You can find the full details in our WCRE'11, CSMR'12, andJSEP '13 papers.
To run it, run the following command from within a Linux tree:
The constraints in Kbuild will be outputted in a "models" directory, with one .makemodel file for each Linux architecture present. Files which are compiled unconditionally will have no constraints.
In order to identify tristate features, we rely on the kconfig models extracted by Undertaker. We basically need the list of features (i.e., which also have a _MODULE variation) defined as tristate in the Kconfig files. A list of such features for releases 2.6.34-3.6 is available here. Add the modules.txt file to your work directory before running Makex. You can simply add an empty modules.txt file, but no _MODULE variation will be generated in the make constraints which may lead to false positives.
You can use this script as an example of how to run the analysis to detect dead and undead blocks with and without the make constraints