update makefile with dependencies and proper static linking