I suppose GDP is supposed to create a measure of a country's wealth/welfare, something easily indexable.
But how exactly is it composed? And is its composition disputed? How good is it at measuring a country's economic well-being?
Gross Domestic Product
Gross domestic product is an aggregate measure of production equal to the sum of the gross values added of all resident institutional units engaged in production (plus any taxes, and minus any subsidies, on products not included in the value of their outputs). The sum of the final uses of goods and services (all uses except intermediate consumption) measured in purchasers' prices, less the value of imports of goods and services, or the sum of primary incomes distributed by resident producer units.
-- OECD, Glossary
In somewhat simpler terms, it is a quantitative measure of the amount of values produced by all industries and services of a given country. For example, if a company buy some tomatoes and produce a tomato sauce, the difference between the money received for selling the sauce and the money spent for buying the tomatoes (and possibly other products) will be added to the GDP of the country where the tomatoes are being transformed1.
The GDP is based on price, and not all prices are known (for example, prostitution, black market, etc.) or need to be estimated, like public services. Therefore the determination of the actual GDP cannot be reached, but some statistical approaches offer various ways to estimate that number. One should note that the different approaches do not always provide similar results. Furthermore slight variations in the definition of the GDP may provide different results. Even if the GDP is used since decades everywhere, there are still some discussion about how to measure it. Some details are provided in Wikipedia and in the references therein. But one way, is to use the expenses approach where the GDP is calculated as
$$GDP = C + I + X - M + P$$
where $C$ is the consumption, $I$ the investments, $X$ the exports, $M$ the imports and $P$ the public spending. More details can be found here or in the already cited wikipedia.
The GDP number is used to indicate the performance of an economy. The higher it is, the more value the country's econmy produced. It is used to
Please note that those are only valid with a constant definition and equal estimation approach. One approach
It can be noted that the GDP value of a country is often normalised by the number of inhabitants of that country. This, to simplify the comparison between countries like Luxembourg and India, which have US\$54,940,000,000 (US\$111,716 per capita) and US\$2,308,018,000,000 (US\$1,627 per capita) respectively (as per IMF in 2014 and 2015 via the corresponding Wikipedia's lists: nominal and per capita). The higher the GDP/capita, the richer the population. But this, however is assuming a good repartition of the wealth, which is not always granted.
Discussions on the validity of GDP
The GDP is an indicator of the current state of an economy. However it tends to be used everywhere, every day by policy makers, economic analysts, journalists, etc. This overpowers other complementary indicators. Which, for policy making is probably insufficient.
As mentioned before, the GDP is used as a measure of how rich the inhabitants of a country are, but due to (sometimes very) inequal repartition of wealth, the GDP could be misleading. Apart from the document cited above, some claim that
neither GDP nor this balance sheet takes account of environmental degradation, insecurity or inequality.
-- François Lequiller, OECD
And, as can be found, there are some discussions about alternative indicators to replace or complement the GDP, which should indicate the wealth as well as environmental, equality and some other parameters.
1. That is the main difference with GNP, which concerns residents, that is to say where the company is registered. More on the subject can be found here.
Although GDP and GNP are promoted as "measuring a country's well-being", that is not their primary purpose. Instead, their purpose is to measure the amount of taxable economic activity in a country.
GDP can be computed in two different ways. Notice that governments can collect taxes on all of the components of these calculations:
By adding up the "value-added" of businesses and governments. In other words, for each product or service that the entity manages to charge people for, add what the entity was able to charge, and subtract what the entity paid for the ingredients of the product.
By adding up the total monetary income of individuals, businesses, and governments. Typically, this income is in the forms of wages, salaries, purchased fringe benefits (such as medical insurance), interest, dividends, and capital gains.
Here are some activities that are relatively easy for a country to tax:
And here are some activities that are relatively hard for a country to tax:
Bilbo's excellent answer suggests some features of GDP calculations that appear to make it bad at "measuring a country's well-being". These are the exact features that make GDP calculations useful for measuring taxable economic activity: