Make "flx" a subroutine.

I want to call "flx" in the Felix based build, without
resorting to using the shell. So whilst this could be done
with an instance of a plugin, its cleaner to actually make
the code an ordinary function (generator actually),
and not use global data.

This is a work in progress commit, the job isn't finsihed.