mklib: expand .a into .o files on FreeBSD, put common code into subroutines