Setting MAKEFLAGS in Fink
From the Fink Wiki
Dire Warnings
This is not officially supported by Fink. If you run into any problems, make sure you first disable it before reporting any errors to maintainers or the mailing lists. Failure to do so will cause you to be shaved, covered in honey, and set upon by fire ants! Well, OK, perhaps that's a bit harsh. But really. Parallel builds can make funny things happen. If it breaks in half, the only guarantee is that you get to keep both halves.
Getting Started
That said, it is technically possible to make use of distcc (or just multiple CPUs) when building packages from source in Fink, as long as the package(s) you're building support the MAKEFLAGS variable (anything that uses make, and possibly other things as well).
To do so, edit /sw/lib/perl5/Fink/PkgVersion.pm and look for the comment that says "# uncomment this to be able to use distcc -- not officially supported!" Uncomment the $defaults{'MAKEFLAGS'} line, and fink should no longer erase MAKEFLAGS from the build environment. Note that every time the fink package gets updated, you will have to do this again. You'll deal with it, I know you can. That's what you get for living on the bleeding edge. ;)
Now, you'll have to make sure that MAKEFLAGS is actually *in* the environment. To do so, install the distcc-default package (you'll need the latest unstable version), and then edit the MAKEFLAGS= line in /sw/etc/distcc.conf as appropriate. Alternatively, if you don't care about distcc, you can make a /sw/etc/profile.d/localenvironment.sh file or similar, and set MAKEFLAGS in there.
When Issues Arise
The first thing to try is to just set MAKEFLAGS to "-j1" in your /sw/etc/distcc.conf or equivalent, and see if it builds. If it does, mail the maintainer for the package (fink info packagename) to add the following lines to his info file:
NoSetMAKEFLAGS: true SetMAKEFLAGS: -j1
Many packages that I've personally had problems with build with that. You don't get a parallel build this way, but you also don't get a dead one. :)
If you still have errors, try also setting CCACHE_CPP2=1. Some stuff bombs because it doesn't like the tricky way ccache runs things through the c preprocessor before getting passed on to the local gcc. In these cases you generally see an error about adding -fconstant-cfstrings to the command-line, or something similar. If that doesn't work, try setting DISTCC_HOSTS to an empty string.
CompileScript: << ./configure %c CCACHE_CPP2=1 make <<
...or...
CompileScript: << ./configure %c DISTCC_HOSTS='' MAKEFLAGS='-j1' make <<
That has fixed things in all cases where just MAKEFLAGS has not, other than the less obvious errors of builds completing, but missing files and such.
If you still have issues, you're on your own. See the top of this page. ;)

