Guest User

Mountain Lion ~/.bashrc for command line compilation

a guest
Sep 7th, 2012
275
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ## Old flags for Lion (10.7)
  3. #ARCHFLAGS="-isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7"
  4. #CFLAGS="-I/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/usr/include -O2 -pipe -fomit-frame-pointer"
  5. #CPPFLAGS="-I/usr/include/ -I/Developer/SDKs/MacOSX10.7.sdk/usr/include"
  6. #LDFLAGS="-L/Developer/SDKs/MacOSX10.7.sdk/usr/lib -L/usr/lib"
  7. #LD_LIBRARY_PATH="/Developer/SDKs/MacOSX10.7.sdk/usr/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/:$LD_LIBRARY_PATH"
  8.  
  9.  
  10. ## Modified for Mountain Lion (10.8)
  11. ARCHFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.8"
  12. CC="gcc"
  13. CPP="gcc -E"
  14. CXX="g++"
  15. CXXCPP="g++ -E"
  16. CFLAGS="-O2 -pipe -fomit-frame-pointer"
  17. CPPFLAGS="-I/usr/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include"
  18. FFLAGS="$CFLAGS"
  19. LDFLAGS="-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib -L/usr/lib"
  20. LD_LIBRARY_PATH="/Applications/Xcode.app/Contents/Developer/usr/lib/:/usr/lib"
  21. MACOSX_DEPLOYMENT_TARGET="10.8"
  22. PATH="/Applications/Xcode.app/Contents/Developer/usr/bin/:$PATH"
  23.  
  24. case $1 in
  25.     32)
  26.         export LDFLAGS="-arch i386 -arch x86_64 $LDFLAGS"
  27.         export FFLAGS="-arch i386 -arch x86_64 $FFLAGS"
  28.         export CFLAGS="-arch i386 -arch x86_64 $CFLAGS $ARCHFLAGS"
  29.         export CPPFLAGS="-arch i386 -arch x86_64 $CPPFLAGS"
  30.     ;;
  31.     64)
  32.         export LDFLAGS="-arch x86_64 $LDFLAGS"
  33.         export FFLAGS="-arch x86_64 $FFLAGS"
  34.         export CFLAGS="-arch x86_64 $CFLAGS $ARCHFLAGS"
  35.         export CPPFLAGS="$CPPFLAGS"
  36.     ;;
  37.     *)
  38.         export LDFLAGS="$LDFLAGS"
  39.         export FFLAGS="-arch x86_64 $FFLAGS"
  40.         export CFLAGS="-arch x86_64 $CFLAGS $ARCHFLAGS"
  41.         export CPPFLAGS="$CPPFLAGS"
  42.     ;;
  43. esac
  44.  
  45. ### GLOBALS ###
  46.  
  47. export ARCHFLAGS="$ARCHFLAGS"
  48. export CC="$CC"
  49. export CPP="$CPP"
  50. export CXX="$CXX"
  51. export CXXCPP="$CXXCPP"
  52. export LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
  53. export MACOSX_DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET"
  54. export PATH="$PATH"
RAW Paste Data