Femtosecond-laser hyperdoping of sulfur in silicon typically produces a concentration gradient that results in undesirable inhomogeneous material properties. Using a mathematical model of the doping process, we design a fabrication method consisting of a sequence of laser pulses with varying sulfur concentrations in the atmosphere, which produces hyperdoped silicon with a uniform concentration depth profile. Our measurements of the evolution of the concentration profiles with each laser pulse are consistent with our mathematical model of the doping mechanism, based on classical heat and solute diffusion coupled to the far-from-equilibrium dopant incorporation. The use of optimization methods opens an avenue for creating controllable hyperdoped materials on demand. (C) 2015 AIP Publishing LLC.