move common headers; refactor out and normalize makefiles