Probably all sorts of convoluted ways but the most straightforward (and reasonably accurate method IMO) is to completely fill the tank, take note of your mileage, drive for a week or so in mixed conditions, fill up to the brim again and note cost of fill and mileage.
January 1st, or whatever date you chose, take your mileage, add up your yearly cost of fuel and take your mileage at the end of the year, and divide the total mileage by the total cost of fuel to get the price per kilometre or mile.
The above will work for fuel costs, but do you want to capture depreciation, maintenance, finance, parking, tolls, tyres, insurance, road-tax, repairs as well?
I suppose you could record all costs associated with your car for a year then devide the costs by the Kms covered in the year, this would give you what you want. Remembering to record the costs as you incur them would be the big job.
The above will work for fuel costs, but do you want to capture depreciation, maintenance, finance, parking, tolls, tyres, insurance, road-tax, repairs as well?
As I pay for nearly everything in relation to my car by lasercard I keep a record in excel of all car costs so I can see over a period of time how much the car cost me.