Modified the Makefiles to execute them in required order.