Start supporting module directories in compile
Reduce build system code duplication