Merge pull request #395 from libgit2/cmn/check-thread-lock

Deduplicate Makefile static target and add thread locking check