diff --git a/compile b/compile
index ae11f96ba8210c56dce4bea35d1e36977ed7f29b..0398ea1cf78b7bded922bdf8b750a8265c7ef08e 100755
--- a/compile
+++ b/compile
@@ -8,15 +8,23 @@ sed -i "s/COMMIT/$COMMIT/" ./src/init/storyInit.tw
 # Run sanity check.
 ./sanityCheck
 
-HASH=`git log -n1 |grep commit | sed 's/commit //'`
-
-if [ $(uname -m) = "x86_64" ]
+ARCH="$(uname -m)"
+if [ "$ARCH" = "x86_64" ]
 then
 	echo "x64 arch"
 	./devTools/tweeGo/tweego_nix64 -o bin/FC_pregmod.html src/
-else
+elif echo "$ARCH" | grep -Ee '86$' > /dev/null
+then
 	echo "x86 arch"
 	./devTools/tweeGo/tweego_nix86 -o bin/FC_pregmod.html src/
+elif echo "$ARCH" | grep -Ee '^arm' > /dev/null
+then
+	echo "arm arch"
+	# tweego doesn't provide arm binaries so you have to build it yourself
+	TWEEGO_PATH=devTools/tweeGo/storyFormats
+	tweego -o bin/FC_pregmod.html src/
+else
+	exit 2
 fi
 
 #Make the output prettier, replacing \t with a tab and \n with a newline
diff --git a/compile-git b/compile-git
index 5d33f0a2be526a421c7cbaa1e3f5c3fca7d97064..c6ea31dc0bc39128c93b002545ad15475876cca4 100755
--- a/compile-git
+++ b/compile-git
@@ -3,18 +3,27 @@
 # Run sanity check.
 ./sanityCheck
 
-HASH=`git log -n1 |grep -m1 commit | sed 's/commit //'`
-
-if [ $(uname -m) = "x86_64" ]
+HASH="$(git rev-list -n 1 --abbrev-commit HEAD)"
+ARCH="$(uname -m)"
+if [ "$ARCH" = "x86_64" ]
 then
 	echo "x64 arch"
-	./devTools/tweeGo/tweego_nix64 -o bin/FC_pregmod_$HASH.html src/
-else
+	./devTools/tweeGo/tweego_nix64 -o "bin/FC_pregmod_$HASH.html" src/
+elif echo "$ARCH" | grep -Ee '86$' > /dev/null
+then
 	echo "x86 arch"
-	./devTools/tweeGo/tweego_nix86 -o bin/FC_pregmod_$HASH.html src/
+	./devTools/tweeGo/tweego_nix86 -o "bin/FC_pregmod_$HASH.html" src/
+elif echo "$ARCH" | grep -Ee '^arm' > /dev/null
+then
+	echo "arm arch"
+	# tweego doesn't provide arm binaries so you have to build it yourself
+	TWEEGO_PATH=devTools/tweeGo/storyFormats
+	tweego -o "bin/FC_pregmod_$HASH.html" src/
+else
+	exit 2
 fi
 
 #Make the output prettier, replacing \t with a tab and \n with a newline
-sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g'  bin/FC_pregmod_$HASH.html
+sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g'  "bin/FC_pregmod_$HASH.html"
 
 echo "FC_pregmod_$HASH.html" compilation finished.