Tectonics and the Formation of Magmas