  We study the thermodynamics of the diffusive SFS trilayer composed of thin
superconductor (S) and ferromagnet (F) layers. On the basis the self-consistent
solutions of nonlinear Usadel equations in the F and S layers we obtain the
Ginzburg--Landau expansion and compute the condensation free energy and entropy
of the $0$ (even) and $\pi$ (odd) order parameter configurations. The first
order $0-\pi$ transition as a function of temperature $T$ occurs, which is
responsible for a jump of the averaged magnetic field penetration depth
$\lambda(T)$ recently observed on experiments [N.Pompeo, et. al., Phys. Rev. B
90, 064510 (2014)]. The generalized Ginzburg-Landau functional was proposed to
describe SFS trilayer for arbitrary phase difference between the
superconducting order parameters in the S layers. The temperature dependence of
the SFS Josephson junction critical current demonstrates the strong
anharmonicity of the corresponding current--phase relation in the vicinity of
the $0-\pi$ transition. In rf SQUID, coexistence of stable and metastable $0$
and $\pi$ states provides integer and half--integer fluxoid configurations.
