Rework the list file.

It's a bit more general, we now specially handle MODULES, but the other
sections, like APP or FILES, is handled simularly.