Dead battery. Almost any engine will make a machine gun noise when the starter doesn't have enough juice to spin.
Here's some physics behind it.
The starter solenoid clicks on and the starter puts a HUGE resistance across the battery. Say, 750 Amps on a diesel (give or take). That amount of amperage is enough to reduce the required voltage and amperage to the solenoid and it clicks off. When the solenoid clicks off, the battery quickly "recovers" from the current draw and the solenoid clicks back on, this repeats so fast it sounds like a machine gun.
Nothing to worry about, as said oil the cylinders throw a battery at it and tinker away!
Hope that helps