issue#11: cds: changed __CDS_ guard prefix to CDSLIB_ for all .h files
[libcds.git] / build / build.sh
index 8c14e71685bfde14a1a39293045b031f9289445e..7e79549d583a3d130b1bf9ab828fc03f9014b0ea 100644 (file)
@@ -18,7 +18,7 @@ usage()
     echo "Usage: build.sh \"options\""
     echo "       where options may be any of the following:"
     echo "       -t make target"
-    echo "       -c <C compiler name> Possible values are: gcc,clang"
+    echo "       -c <C compiler name> Possible values are: gcc,clang,icc"
     echo "       -x <C++ compiler name> (e.g. g++, CC)"
     echo "       -p <Processor architecture> Possible values are:"
     echo "             x86, amd64 (x86_64), sparc, ia64"
@@ -208,6 +208,11 @@ case $ccompiler in
                        cppcompiler=clang++
                fi
                ;;
+       icc)
+               if test $cppcompiler = ''; then
+                       cppcompiler=icc
+               fi
+               ;;
        *)
                echo "ERROR: Unknown compiler: $ccompiler"
                exit $ERROR_EXIT_CODE
@@ -389,13 +394,49 @@ case $ccompiler in
            ;;
        esac
 
-       cppcompiler_version=`$cppcompiler -dumpversion`
-       echo g++ version=$gcc_version
+       #cppcompiler_version=`$cppcompiler -dumpversion`
+       #echo compiler version=$cppcompiler $cppcompiler_version
 
        # Setup target options
        # buildCXXflags="-std=gnu++0x $buildCXXflags"
-       cxx_debug_options="-D_DEBUG -O0 -g $cxx_debug_options"
-       cxx_release_options="-DNDEBUG $cxx_release_optimization $cxx_release_options"
+       #cxx_debug_options="-D_DEBUG -O0 -g $cxx_debug_options"
+       #cxx_release_options="-DNDEBUG $cxx_release_optimization $cxx_release_options"
+       ;;
+    icc)
+       case $processor_arch in
+       amd64)
+           case $OS_FAMILY in
+           linux)
+               buildCXXflags="-fPIC -march=$ArchFlag $amd64_cxx_options"
+               buildCflags="-fPIC -march=$ArchFlag $amd64_cxx_options"
+               buildLDflags="-fPIC"
+               buildTestLDflags="-fPIC"
+               ;;
+           *)
+               echo "Warning: cannot determine compiler flags for processor $processor_arch, OS $OS_FAMILY, and compiler $ccompiler"
+               #exit ${ERROR_EXIT_CODE}
+               ;;
+           esac
+           ;;
+       x86)
+           case $OS_FAMILY in
+               linux)
+                   buildCXXflags="-fPIC -march=$ArchFlag"
+                   buildCflags="-fPIC -march=$ArchFlag"
+                   buildLDflags="-fPIC"
+                   buildTestLDflags="-fPIC"
+                   ;;
+               *)
+                   echo "Warning: cannot determine compiler flags for processor $processor_arch, OS $OS_FAMILY, and compiler $ccompiler"
+                   #exit ${ERROR_EXIT_CODE}
+                   ;;
+           esac
+           ;;
+       *)
+           echo "Warning: cannot determine compiler flags for processor $processor_arch and compiler $ccompiler"
+           #exit ${ERROR_EXIT_CODE}
+           ;;
+       esac
        ;;
     *)
        echo "ERROR: Unknown compiler: $ccompiler"
@@ -403,6 +444,15 @@ case $ccompiler in
        ;;
 esac
 
+cppcompiler_version=`$cppcompiler -dumpversion`
+echo compiler version=$cppcompiler $cppcompiler_version
+
+# Setup target options
+# buildCXXflags="-std=gnu++0x $buildCXXflags"
+cxx_debug_options="-D_DEBUG -O0 -g $cxx_debug_options"
+cxx_release_options="-DNDEBUG $cxx_release_optimization $cxx_release_options"
+
+
 if test $BOOST_INCLUDE_PATH != ''; then
        buildCXXflags="$buildCXXflags -I$BOOST_INCLUDE_PATH"
 fi
@@ -467,15 +517,19 @@ fi
 
 echo ---------------------------------
 echo Make debug library
-CXXFLAGS="$compileroptions $cxx_debug_options $EXTRA_CXXFLAGS"
-export CXXFLAGS
-CFLAGS="$compileroptions $cxx_debug_options $EXTRA_CFLAGS $debugflag "
-export CFLAGS
-LDFLAGS="$linkeroptions -shared $ld_debug_options $ld_libs $EXTRA_LDFLAGS "
-export LDFLAGS
+#CXXFLAGS="$compileroptions $cxx_debug_options $EXTRA_CXXFLAGS"
+#export CXXFLAGS
+#CFLAGS="$compileroptions $cxx_debug_options $EXTRA_CFLAGS $debugflag "
+#export CFLAGS
+#LDFLAGS="$linkeroptions -shared $ld_debug_options $EXTRA_LDFLAGS "
+#export LDFLAGS
 
 mkdir -p $OBJ_PATH/debug
 
+CXXFLAGS="$compileroptions $cxx_debug_options $EXTRA_CXXFLAGS" \
+CFLAGS="$compileroptions $cxx_debug_options $EXTRA_CFLAGS $debugflag " \
+LDLIBS="$ld_libs" \
+LDFLAGS="$linkeroptions -shared $ld_debug_options $EXTRA_LDFLAGS " \
 $MAKE -f Makefile \
      platform=$OS_FAMILY \
      BIN_PATH=$BIN_PATH \
@@ -489,15 +543,19 @@ fi
 echo ---------------------------------
 echo Make release library
 
-CXXFLAGS="$compileroptions $cxx_release_options $EXTRA_CXXFLAGS "
-export CXXFLAGS
-CFLAGS="$compileroptions $cxx_release_options $EXTRA_CFLAGS "
-export CFLAGS
-LDFLAGS="$linkeroptions -shared $ld_resease_options $ld_libs $EXTRA_LDFLAGS "
-export LDFLAGS
+#CXXFLAGS="$compileroptions $cxx_release_options $EXTRA_CXXFLAGS "
+#export CXXFLAGS
+#CFLAGS="$compileroptions $cxx_release_options $EXTRA_CFLAGS "
+#export CFLAGS
+#LDFLAGS="$linkeroptions -shared $ld_resease_options $ld_libs $EXTRA_LDFLAGS "
+#export LDFLAGS
 
 mkdir -p $OBJ_PATH/release
 
+CXXFLAGS="$compileroptions $cxx_release_options $EXTRA_CXXFLAGS " \
+CFLAGS="$compileroptions $cxx_release_options $EXTRA_CFLAGS " \
+LDFLAGS="$linkeroptions -shared $ld_resease_options $EXTRA_LDFLAGS " \
+LDLIBS="$ld_libs" \
 $MAKE -f Makefile \
      platform=$OS_FAMILY \
      BIN_PATH=$BIN_PATH \