  The barotropic ideal fluid with step and delta-function discontinuities
coupled to Einstein's gravity is studied. The discontinuities represent star
surfaces and thin shells; only non-intersecting discontinuity hypersurfaces are
considered. No symmetry (like eg. the spherical symmetry) is assumed. The
symplectic structure as well as the Lagrangian and the Hamiltonian variational
principles for the system are written down. The dynamics is described
completely by the fluid variables and the metric on the fixed background
manifold. The Lagrangian and the Hamiltonian are given in two forms: the volume
form, which is identical to that corresponding to the smooth system, but
employs distributions, and the surface form, which is a sum of volume and
surface integrals and employs only smooth variables. The surface form is
completely four- or three-covariant (unlike the volume form). The spacelike
surfaces of time foliations can have a cusp at the surface of discontinuity.
Geometrical meaning of the surface terms in the Hamiltonian is given. Some of
the constraint functions that result from the shell Hamiltonian cannot be
smeared so as to become differentiable functions on the (unconstrained) phase
space. Generalization of the formulas to more general fluid is straifgtforward.
