[sam] Added -MMD flag to tell compiler to produce dependencies files

Now a full rebuild of the sketch is triggered only if needed.