Makefile: fix the order of the deps while linking