Makefile: fix concurrency issue leading to linking errors

main.c needs to be recompiled if the version name changes. When doing
multi-threaded compiling (make -j), main.o would sometimes be deleted
right after it was compiled, triggering a linking error of the "opensips" binary.

The patch also prevents main.c to be recompiled each time if the ".git" dir
is not present. (i.e. compiling a tarball archive). Credits to Răzvan
Crainea.

Thanks to Bobby Hakimi for offering a replication environment.
Closes #373