changed -lpthread to -pthread of LDFLAGS

For the newer version of GCC, the placement of -l option does matter,
and it cannot compile successfully now. Libraries must be specified
after the objects in the linking command.

Also, there is another option -pthread which seems more preferred.