Bioenergy production from second- and third-generation feedstocks