Introduction
In large-scale software projects, build code has a high level of complexity, churn rate, and defect proneness. While it is desirable to have automated tools to help developers in localizing faults in build code, it is challenging to build such tools due to the dynamic nature of build code. Existing automatic fault localization methods focus on traditional code and none of them has such support for build code. This pa-per introduces MkFault, a novel automatic tool/method to localize faults in build code that cause run-time build fail-ures. Given a test case that causes a run-time crash in the execution of a Makefile, it returns a ranked list of statements in the Makefile with their suspiciousness scores. MkFault records the evaluation traces from Make code statements to produce the corresponding concrete build rules as well as the execution traces of those rules. It then uses those traces and its novel Bayesian-like rating algorithm to give suspiciousness scores to the original statements in the Makefile. Our empirical evaluation on real faults in several open-source projects has shown that MkFault can achieve a high level of top-5 accuracy (58-88%) and can help reduce 80-96% of the lines of code that developers need to examine.