- 2 pounds onions, cut into 1-inch pieces
 - 1 pound shallots, halved
 - 12 garlic cloves, peeled
 - 1/4 cup vegetable oil
 - 1 teaspoon fenugreek seeds
 - 1 tablespoon thinly sliced fresh curry leaves (optional)
 - 1 tablespoon ground cumin
 - 1 teaspoon ground cardamom
 - 1 teaspoon brown mustard seeds
 - 3/4 teaspoon turmeric
 - 1/2 teaspoon grated nutmeg
 - 1/2 teaspoon hot red-pepper flakes
 - 1/4 teaspoon ground cloves
 - an electric coffee/spice grinder or a mortar and pestle
 
- Preheat oven to 350°F with rack in middle.
 - Pulse onions in 3 batches in a food processor until very coarsely chopped (there may be a few large pieces remaining), transferring to a bowl. Repeat with shallots, then garlic.
 - Heat oil in a deep 12-inch heavy nonstick skillet over high heat until it shimmers, then sauté onions, shallots, and garlic (stir often) until golden and browned in spots, 25 to 30 minutes
 - Grind fenugreek seeds in grinder or with mortar and pestle. Add to onion mixture along with remaining ingredients, 1 tablespoon salt, and 1 teaspoon pepper and stir until combined.
 - Transfer to a parchment-paper-lined large 4-sided sheet pan and spread as thinly and evenly as possible. Bake, stirring occasionally with a skewer to separate onions, until well browned and barely moist, 1 to 1 1/4 hours.