An innovative optical scheme to generate software-defined phase-modulated radio frequency (RF) pulses with carrier frequency agility from a mode-locked laser (MLL) is proposed. The technique exploits a direct digital synthesizer and a Mach-Zehnder modulator to apply an intermediate frequency modulation to the MLL's modes. The heterodyne detection of the optical signal allows the generation of amplitude- and phase-modulated RF carriers with very high phase stability, suitable for coherent radar applications. Further, a single MLL can be used to generate carriers simultaneously at different frequencies, enabling frequency hopping or multifunctional radars, with no need to increase the complexity of the transmitter. Results show chirped and Barker-coded pulses at around 10 or 40 GHz in a single setup, without any performance degradation while increasing the carrier frequency. The proposed technique allows the practical realization of compressed pulses for coherent radars over a wide carrier frequency range, allowing the development of software-defined radar systems with improved functionalities.