The word mill has an interesting history. In the tenth century, it was used exclusively to describe a building where grain was ground: it didn't come to mean a machine for grinding food until the 15th century. That said, in the tenth century, most mills were powered by water or by wind, so the building was effectively the machine.
The word sawmill originated in 1550, and they were still powered by wind or water, so the building was the machine. The first steam powered sawmill was built by Henry Yesler in Seattle in 1853: the sawmill was just a machine that was housed in a building. It wasn't until the early twentieth century that it became possible to build a truly portable, gasoline powered sawmill- one that really didn't need a building. That said, it is still relatively unusual to have a mill that is not housed in a building.
Just to be clear: the function of a sawmill is to cut logs into planks: it is never used for cutting trees.