Add support for MacPorts to the Makefile

Fix main.o compilation and add definition of MacPorts specific env variables.