Fix Makefile bug

    Moved LIB flags to the end of the command line, it was giving error in
Ubuntu (didn't find libraries)

Mark: I went ahead and moved LIBRARY_FLAGS to the end of the line for all
targets, otherwise I also get errors building suse rpms.

Signed-off-by: Jordi Vicedo <jordi@vicedo.cat>