Fixed dependency handling in Makefiles