Move LDFLAGS after output for LIB and EXE to fix failed linking.