Fix up header file dependencies and add sparse checking rules