How will SpaceX make rocket propellants for Starship on Mars?

The first Starship to land on Mars will carry a small manufacturing plant to produce propellants for the return trip. How will that work?