Fix makefile: move LDFLAGS to the correct location.

Linker flags should always come last. By default, ld adds DT_NEEDED tags
for all libraries passed on the comamnd line, even unused ones. If the
--as-needed flag is passed, ld only adds DT_NEEDED tags for libraries
that are used.

ld parses its arguments in series. --as-needed causes ld to add
DT_NEEDED tags according to the object files that were passed before it.
If all of the object files are passed after --as-needed is passed, ld
will fail to resolve all references to dynamically linked symbols.

Arch Linux's makepkg script sets LDFLAGS=...--as-needed... by default.