Rewrite scan_includes.py. Add include paths.

Besides being cleaner and more flexible, allows the makefile to be path-neutral.