This code fixes the problem: mkdirs:: !if !exist($(OBJ)) echo > a.tmp # xcopy will build any missing directory structure: echo F | xcopy a.tmp $(OBJ)\a.tmp del a.tmp del $(OBJ)\a.tmp !endif But all the uses of mkdirs pass arguments that are ignored. Should mkdirs process its input arguments or should they be removed from the callers?