As Syria’s Muslims observe the fasting month of Ramadan at a time of war for a third year running, many people are turning to black humour to help them cope.

Jokes are a way to weather the difficulties of food shortages, violence and death that mar the sense of community and celebration supposed to accompany the religious month.

One popular joke plays off the traditional cannon fire that marks the end of the fasting day and the beginning of the iftar evening meal.

“Watch out! Just because you hear the sound of cannon fire doesn’t mean it’s time to break your fast,” the joke goes, a sad testament to the frequent sound of warfare across the country.

In areas less affected by violence, residents might each night still be able to hear the msaharati, a man who walks the streets before dawn, waking people to eat before the fast begins.

But in areas ravaged by snipers and shelling, upholding such a tradition has become impossible.

A text message joke picture doing the rounds shows a tank topped with the traditional fez hat worn by the msaharati, rumbling through the streets to waken the faithful instead.

In Homs, where regime forces are pressing an assault against several rebel-held areas, residents have been able to maintain an edgy sense of humour, despite the tough times.

“Breaking news!” reads a text message forwarded among residents of the city in central Syria.

“The msaharati spent hours beating his drum, trying to get people to wake up. But when they didn’t listen, he decided to blow himself up!”

Much of the humour is dark, playing on the chronic food shortages experienced by many people across the country.

“It’s not hard to fast in Ramadan… What’s hard is to find food with which to break the fast,” one young Syrian writes on Facebook.

Even those relatively insulated from the violence that has ravaged Syria, killing more than 100,000 people according to one watchdog, struggle to observe Ramadan in the usual way.

Burdened by inflation and security problems on the roads, housewives are now making more food at home and relying less on buying special Ramadan sweets from the shops.

“The crisis will not stop me from keeping our traditions alive,” said Damascus resident Umm Mazen.

She is resorting to recipes she inherited from her mother to feed her family during the holy month.

Damascus is known across the Middle East for its varied confectionery tradition. The city’s sweet makers use pistachios, pine nuts, honey, lemon and rosewater for their mouthwatering recipes.

Because of soaring prices, Abu Adnan’s liquorice and tamarind drinks shop has far fewer customers than other years, when it was a Ramadan favourite.

“The situation is getting worse… Most people who used to come to the store now prefer to make their own drinks at home,” the elderly Abu Adnan told AFP.

In response to the severe shortages, the government decided in July to ban the export of food, saying it would charge anyone caught smuggling.

The conflict is also testing the country’s charities, which are working to give out more food to the needy during Ramadan, including to thousands of families displaced by violence.

Social networking sites are abuzz with initiatives and campaigns urging Syrians to help the worse-off.

Activist group “Help” has organised charity drives including a “Let’s defeat hunger” campaign.

Restaurant and shop owners are also trying to do good by advertising “cost price meals” — dinners offered for the price of the ingredients without a profit, to the needy.

After more than two years of war that has killed tens of thousands and displaced millions, many Syrians are eager to take a moment to reflect and pray for their country.

“It’s no longer about being pro- or anti-regime,” says 32-year-old Abdullah, who works as an accountant in the capital.

“People just want to live now.”