Matlab codegen problem on Mac OS X 10.7

You might encounter the problem like can't find the path for some header files: math.h, stdlib.h float.h, etc.

A common cause for it is Xcode. So install Xcode first if you haven't done it yet. Then, check the SDKROOT line in mexopts.sh, see whether it matches the path of Xcode on your Mac. For older versions of Xcode, the path is:
/Developer/SDKs/MacOSX10.7.sdk

for newer versions, it is:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk(might be 10.7)