diff --git a/docs/COMPILE-NIX.md b/docs/COMPILE-NIX.md
index a02caa1a649660871f9b9cc32473c90ad783464c..5026cdcd39bcf937466cb216e4a5287276d2df20 100644
--- a/docs/COMPILE-NIX.md
+++ b/docs/COMPILE-NIX.md
@@ -22,6 +22,11 @@ For Windows, see [COMPILE-WINDOWS.md](COMPILE-WINDOWS.md)
         $ cd build
         $ ../make-share.sh
 
+   In the case you want to compile with all the debug information, replace the
+   last line with:
+
+        $ ../make-share.sh debug
+
    By default, this builds all architectures, which is: AArch64, ARM, Hexagon,
    Mips, PowerPC, Sparc, SystemZ & X86. To compile just some selected ones,
    pass a semicolon-separated list of targets to LLVM_TARGETS_TO_BUILD,
@@ -36,6 +41,11 @@ For Windows, see [COMPILE-WINDOWS.md](COMPILE-WINDOWS.md)
         $ cd build
         $ ../make-lib.sh
 
+   In the case you want to compile with all the debug information, replace the
+   last line with:
+
+        $ ../make-lib.sh debug
+
    Like above, this builds all architectures. To compile just some selected ones,
    pass a semicolon-separated list of targets to LLVM_TARGETS_TO_BUILD,
    like follows if we only want AArch64 & X86.
diff --git a/make-lib.sh b/make-lib.sh
index 200cef44c33c1bd9566526ac9aeb6a1a5a5b0efa..599981535665598c30dd255439cfc7f28dd1633d 100755
--- a/make-lib.sh
+++ b/make-lib.sh
@@ -1,5 +1,13 @@
 #!/bin/sh -ex
 
+if [ -n "$1" ]
+then
+# compile with DEBUG option
+cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
+else
+# default compile
 cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
+fi
+
 time make -j8
 
diff --git a/make-share.sh b/make-share.sh
index a2358a0c67537bd2e8ec6d377371921b9676f43a..1b3ae7df32c175de699a44b1f73e3beacc5074e1 100755
--- a/make-share.sh
+++ b/make-share.sh
@@ -1,4 +1,12 @@
 #!/bin/sh -xe
 
+if [ -n "$1" ]
+then
+# compile with DEBUG option
+cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
+else
+# default compile
 cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
+fi
+
 time make -j8