Crystal structures, phase relationships, and magnetic phase transitions of R5M4 compounds (R = rare earths, M = Si, Ge)