Not to mention using "which was red" to desambiguate the first one too.
Vir pinxit domum, quae erat rubea. ("The man painted the house, which was red".)
Vir pinxit domum ut rubeam faceret. ("The man painted the house to make it red.")
Though as mwh said, it's be more natural to say Vir pinxit domum rubeam and leave the ambiguity to context...
ēlūcet mâiōrem habēre vim ad discenda ista līberam cūriōsitātem quam meticulōsam necessitātem
It is clear that a free curiosity has a greater force in order to learn these things [languages] than a necessity based on fear. (St. Augustine, Cōnfessiōnēs I.14)