It sounds like your cat is suffering a urinary tract infection at least. It could be much worse and the progression of this problem is often quite fast and very serious.
Please get him to a vet or a clinic - mention to them what is suspected and they should get him in as a priority.
If they decide this is not an infection, it sounds like he's having territorial issues. Has there been a new addition to the household? Either a new pet or person? Perhaps there's a stray visiting the yard?
Is he a neutered male? If not - neutering may very well address this smelly and distressing habit of 'marking'.
Please check back with me to let me know
Many have forgotten this truth, but you must not forget it.
You remain responsible, forever, for what you have tamed.