We describe a pulse-shaping technique that uses second-harmonic generation with Fourier synthetic quasi-phase-matching gratings. We demonstrate both amplitude and phase tailoring by generating a picosecond squarelike pulse as well as trains of femtosecond pulses with a terahertz-range repetition rate from either a compressed or a chirped pump pulse.