In situ controlled fabrication of stacks of high-Tc intrinsic Josephson junctions