Bugfix compilation of C code via farm could fail

Newer version of gcc barfs if the library flags are not in the proper
dependency ordering, resulting in the compiler failing to find the definition
of a referenced function.

Object files or static libraries that make reference to functions in
other libraries must be listed before those libraries in the command
line during compilation [1].

Fix this by moving the $flags variable, which may contain references to
libraries, to the end of the compiler command line.

[1] http://stackoverflow.com/questions/45135/linker-order-gcc