How BuildInfer uses ptrace to record system calls during a build, analyse the resulting event log, and automatically generate Buck or Bazel build files — demonstrated on LLVM, OpenCV, and Mapnik.