(MAINT) refactor makefiles for eventual windows addition

- Refactors makefiles
- Ensure that cross compilation works