make Makefile more modular and use dependencies properly