In the laser plasma interaction of quantum electrodynamics (QED)-dominated regime, γ-rays are generated due to synchrotron radiation from high-energy electrons traveling in a strong background electromagnetic field. With the aid of 2D particle-in-cell code including QED physics, we investigate the preplasma effect on the γ-ray generation during the interaction between an ultraintense laser pulse and solid targets. We found that with the increasing preplasma scale length, the γ-ray emission is enhanced significantly and finally reaches a steady state. Meanwhile, the γ-ray beam becomes collimated. This shows that, in some cases, the preplasmas will be piled up acting as a plasma mirror in the underdense preplasma region, where the γ-rays are produced by the collision between the forward electrons and the reflected laser fields from the piled plasma. The piled plasma plays the same role as the usual reflection mirror made from a solid target. Thus, a single solid target with proper scale length preplasma can serve as a manufactural and robust γ-ray source.