Move various common utils out into a separate utils.cpp
Update makefile to use automatic makedeps generation.
Fix base64 encoding for single-instance lockfile sometimes include a '/'
Replace all / with _.