Optimize build.py by generating .deps files.