Dirac structures and Morse families are used to obtain a geometric formalism that unifies most of the scenarios in mechanics (constrained calculus, nonholonomic systems, optimal control theory, higher-order mechanics, etc.), as the examples in the paper show. This approach generalizes the previous results on Dirac structures associated with Lagrangian submanifolds. An integrability algorithm in the sense of Mendela, Marmo and Tulczyjew is described for the generalized Dirac dynamical systems under study to determine the set where the implicit differential equations have solutions. the presymplectic structure by the dynamics under the assumption of the integrability of the Dirac structure. The paper ends with a section devoted to future work. The final appendix contains details about the relation between the Dirac structures of interest to us and some natural maps in mechanics.Acknowledgements.