Copied make rule logic