The Formation of Giant Elliptical Galaxies and Their Globular Cluster Systems