Improved Makefiles with dependency handling