update makefile

this is untested but should work.  It fixes a few things
- using "-lpthread" is wrong. use "-pthread" instead
- rely on implicit rules rather than explicit ones
- use standard Makefile names
reverting last pull request; it did not work