This paper presents a general framework to derive a discrete adjoint method for the optimal control of unsteady flows. The complete formulation of a generic time-dependent optimal design problem is introduced and it is outlined how to derive the discrete set of adjoint equations in a general approach. Results are shown that demonstrate the application of the theory to the drag minimization of viscous flow around a rotating cylinder, and to the remote inverse design of laminar flow around the multi-element NLR 7301 configuration at a high angle of attack. In order to reduce the considerable computational costs of unsteady optimization, the use of bigger time steps over transitional or unphysical adjusting periods as well as omitting time steps while recording the flow solution are investigated and are shown to work well in practice.