We study the most general supersymmetric warped M-theory backgrounds with non-trivial G-flux of the type Ê 1,2 × M 8 and AdS 3 × M 8 . We give a set of necessary and sufficient conditions for preservation of supersymmetry which are phrased in terms of G-structures and their intrinsic torsion. These equations may be interpreted as calibration conditions for a static "dyonic" M-brane, that is, an M5-brane with self-dual three-form turned on. When the electric flux is turned off we obtain the supersymmetry conditions and non-linear PDEs describing M5-branes wrapped on associative and special Lagrangian three-cycles in manifolds with G 2 and SU(3) structures, respectively. As an illustration of our formalism, we recover the 1/2-BPS dyonic M-brane, and also construct some new examples.