[OT] OS X shared library creation

I realise this is off-topic for SDL, but I know that there are many
people here who will have dealt with this problem and it will most
likely be relevant for people trying to make their code portable:

How does one create shared libraries on OS X?

I used to use this:

cc -o file1.o -c -fPIC file1.c
cc -o file2.o -c -fPIC file2.c
cc -o file3.o -c -fPIC file3.c
libtool -dynamic -o libfile.dylib file1.o file2.o file3.o -lc

This works on everything pre OS X 10.4. Note that libtool isn’t
GNU libtool, it’s some utility bundled with OS X. That caught me
out at first! OS X 10.4 fails with some linker errors:

ld: for architecture ppc
ld: Undefined symbols:
libtool: internal link edit command failed

Not really much help, to be honest.

The ADC site suggests a method that looks very odd, and even
suggests that modifications to the source must be made, which
is unnacceptable in my view (it smells of vendor lock-in).

Any suggestions?