We report a photonic scheme to generate multiband and multi-format microwave signals based on a commercial dual-polarization Mach–Zehnder modulator (DP-MZM). The key novelty of this work is the compact signal generator benefitting from the single modulator and the flexible multi-format signals at the multiband. The upper Mach–Zehnder modulator (MZM) of the DP-MZM is used to generate an optical frequency comb, while the lower MZM is driven by baseband electrical coding or single-chirp signal to obtain the multi-format modulated optical signal. The proposed scheme is theoretically analyzed and experimentally demonstrated. A multiband phase-coded microwave signal with a bit rate of 2 Gb/s and complementary linearly chirped microwave waveform pairs with a time duration of 1 µs and a bandwidth of 2 GHz have been successfully generated. The performance of pulse compression of generated signals is also demonstrated.