Using quantum electrodynamic particle-in-cell simulations, we optimize the conditions for the gamma flare generation in the interaction of high power petawatt-class laser pulse with tailored targets having extended preplasma corona. We demonstrate the generation of an energetic flare of gamma- photons with energies in the GeV range and total flare energy being on a kilojoule level with an efficient conversion of the laser energy to gamma radiation. We discuss how the target engineering and laser pulse parameters influence the gamma-flare generation efficiency. This type of experimental setups for laser-based gamma source would be feasible for the upcoming high-power laser facilities. Applications of high intensity gamma ray beams are also discussed.