makefile: conditional linking order for linux/osx