For these kind of analysis, Life Cycle Assessment (LCA) is used to quantify the carbon footprint of a product starting from its production until it is disposed off or recycled. You should be able to find articles on Life Cycle Assessment of different production processes and technologies.
Yes, you have to take into account the carbon footprint of both cars to have a better knowledge of whats is real. For example, you can charge an electric car in your house. So you are using fossil energy. But, electric cars companies are arguing that you are not burning fuel in your car so you have no emisions and that the car is more efcient in term of mile per kWh of charge than mile per gallons, and that you will have a real saving in to your pockets. But, in terms of greener, theres a lot of other factor to take into account like materials used and production. So, a carbon footprint analisis is a more precise way to know whats for real.
to my understanding, the major benefit is like Salman says you do not generate emissions from burning fuel inside already polluted areas.
However, you need to consider the production of the car: the body is the same, the engine is much simpler, however using slightly different materials, you need batteries.And probably the useful lifetime of an electric car is shorter than that of a regular one.
You need electricity, you need charging infrastructure. Of course, to be true with conventional infrastructure you need gas stations and distribution of gas (or diesel). And to charge, you need of course energy, but the problem with us is you need power also, because everybody wants quick charging. So you have to consider the mode of local power generation (hydro, wind, PV, gas, coal, nuclear) and grid losses.
Therefore you probably have to account for an upgrade in electrical infrastructure, whereas the need for roads and parking space stays the same.
in this respect http://shrinkthatfootprint.com/electric-cars-green looks a good study. The result is, main issue is the power source.
As things stand electric cars are far from 'green'. Major advances in technology and urban renewal will be need before that happens. In reality the idea of replacing all gasoline fuelled cars with electric ones is a non-starter.
We simply do not have the resources to manufacture hundreds of millions of batteries to power them.