AFAIR I deprived use of -xarch=v9 and used -m64 instead. I wonder why are you using LDFLAGS='-L/usr/lib/sparcv9 -L/usr/ucblib/sparcv9', when you provide -xarch=v9 compiler should automatically pick the correct libraries and headers I think. There seems lot of cflags used, are you using them because of any recommendation or any issue faced ?.
I just gave LDFLAGS in-case compiler cannot pickup the libraries and the locations i gave in LDFLAGS is for 64 Bit libraries. "-m64" in CFLAGS is generating an error and CC="gcc -m64" is running successfully. So, no issues there.