diff --git a/.gitattributes b/.gitattributes
index b7d99216ff3c78bf2d5b53ebe3c2293b90e960d1..37e62a9f638910ff088d167cb777b913e5eeb3c8 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,9 @@
 * text=auto !eol
 /build-all.sh -text
+/build_diehard.sh -text
 /cfar_postgres_setup.sh -text
 /clean-all.sh -text
+/clean_diehard.sh -text
 /get-peasoup-packages.sh -text
 /irdb_vars -text
 /postgres_setup.sh -text
diff --git a/build-all.sh b/build-all.sh
index 901ae59512f8cc49332811388a80e3d25d248b6b..ce85496a047043801bfa57683b822721f322d3cb 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -10,7 +10,7 @@ if [ "$PEASOUP_UMBRELLA_DIR" != "$FULL_BUILD_LOC" ]; then
     exit 1;
 fi
 
-if [ `basename $BUILD_LOC` == "cfar_umbrella" ]; then
+if [ `basename $FULL_BUILD_LOC` == "cfar_umbrella" ]; then
 	cfar_mode="--enable-cfar"
 fi
 
@@ -101,11 +101,16 @@ cd $IRDB_TRANSFORMS
 scons || exit
 
 
-
-if [ `basename $BUILD_LOC` == "cfar_umbrella" ]; then
-	mkdir -p lib
-	cd DieHard/src
-	make linux-gcc-x86-64
-	cd $PEASOUP_UMBRELLA_DIR
-	cp DieHard/src/libdiehard.so lib
+cd $PEASOUP_UMBRELLA_DIR
+if [ -d DieHard ]; then
+	./build_diehard.sh
 fi
+
+cd $PEASOUP_UMBRELLA_DIR
+
+
+echo
+echo
+echo  "Overall build complete."
+echo
+echo
diff --git a/build_diehard.sh b/build_diehard.sh
new file mode 100755
index 0000000000000000000000000000000000000000..041fa5a21747fbce5b20eb4e2d49471827feb626
--- /dev/null
+++ b/build_diehard.sh
@@ -0,0 +1,15 @@
+#!/bin/bash 
+
+
+if [ ! -f DieHard/src/libdiehard.so ]; then
+
+	sed -i "s|/dev/urandom|/dev/cfar_urandom|" \
+		DieHard/src/archipelago/benchmarks/pine4.64/imap/src/osdep/unix/ssl_unix.c \
+		DieHard/src/include/rng/realrandomvalue.h \
+		DieHard/src/exterminator/src/realrandomvalue.h 
+	cd DieHard/src
+	make linux-gcc-x86-64
+fi
+
+echo Diehard Build complete.
+
diff --git a/clean-all.sh b/clean-all.sh
index 978dc7e67e752616c9afb31c42837015223addf5..8bcb909af40dc33175a028116b4528a3256c2200 100755
--- a/clean-all.sh
+++ b/clean-all.sh
@@ -48,3 +48,6 @@ if [ -d $ZIPR_HOME ]; then
 	cd $ZIPR_HOME
 	scons -c || exit
 fi
+
+cd $PEASOUP_UMBRELLA_DIR
+./clean_diehard.sh
diff --git a/clean_diehard.sh b/clean_diehard.sh
new file mode 100755
index 0000000000000000000000000000000000000000..c62db6d6051032571b3d6b3d172c2562df13a41a
--- /dev/null
+++ b/clean_diehard.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+\rm -f DieHard/src/libdiehard.so
+
+echo Diehard cleaned.