Place chili pepper flakes in four cups of hot water; leave the peppers to soften for 30 minutes to an hour.
While the peppers are soaking, heat a skillet over medium heat until hot.
Add the whole spices and toast until fragrant, stirring constantly, for about a minute.
Remove the pan from the heat and grind the spices with a mortar and pestle or spice grinder. Set aside.
Drain the chili peppers and gently squeeze out excess water with a paper towel.
Using a mortar and pestle (or a blender or mini food processor) grind the chili peppers, garlic, salt and spices to a paste.
Add the lemon juice and just enough olive oil to moisten the harissa to desired consistency. Taste and adjust seasoning.
Store unused harissa in an airtight glass container in the fridge. For long storage, lightly top the harissa with a little oil before closing.