Whamcloud - gitweb
land b1_5 onto HEAD
[fs/lustre-release.git] / build / lmake
index 0c195c0..1410561 100755 (executable)
@@ -10,6 +10,7 @@ TARGET_ARCH=
 TARGET_CONFIG=
 JOBS=1
 CONFIGURE_FLAGS=
+TMPDIR=${TMPDIR:-"/var/tmp"}
 
 # commands to run
 BUILD_LUSTRE=0
@@ -260,6 +261,25 @@ load_target()
     fi
 }
 
+# do these after load_target(), which maybe export CC
+setup_ccache_distcc()
+{
+    # distcc can't handle ".incbin"
+    if [ "$TARGET" == "2.6-suse" -o "$TARGET" == "2.6-rhel4" ]; then
+        if [ "$TARGET_ARCH" == "x86_64" ]; then
+            unset DISTCC
+        fi
+    fi
+    
+    CC=${CC:-gcc}
+    if [ "$CCACHE" ]; then
+        CC="$CCACHE $CC"
+        [ "$DISTCC" ] && export CCACHE_PREFIX="$DISTCC"
+    else
+        [ "$DISTCC" ] && CC="$DISTCC $CC"
+    fi
+}
+
 tarflags()
 {
     case "$1" in
@@ -492,6 +512,7 @@ build_lustre()
        < build/lustre.spec.in \
        > build/lustre.spec
     $RPMBUILD --target ${TARGET_ARCH} -bb build/lustre.spec \
+        --define "_tmppath $TMPDIR" \
        --define "_topdir $(lbuild_topdir)" || \
        fatal 1 "Error building Lustre rpms."
     # $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre."
@@ -785,6 +806,7 @@ done
 
 check_options
 load_target
+setup_ccache_distcc
 
 extract_kernel
 patch_kernel