The production of $\phi$, $\omega$ and $\rho$ mesons in p-, d-, S-. and Pb-induced reactions at the CERN SPS