Ignore build leftovers.
Fix missing variable on macosx.
Move list_ports() implementations to OS-specific files.