Fix behaviors for whitespaces

Also add a couple of tests.
diff --git a/func.go b/func.go
index db4c552..7bb94aa 100644
--- a/func.go
+++ b/func.go
@@ -4,7 +4,6 @@
 	"fmt"
 	"os/exec"
 	"path/filepath"
-	"regexp"
 	"strings"
 )
 
@@ -118,13 +117,12 @@
 	}
 	out, err := cmd.CombinedOutput()
 	if err != nil {
-		panic(err)
+		Log("$(shell %q) failed: %q", args, err)
 	}
-	re, err := regexp.Compile(`\s`)
-	if err != nil {
-		panic(err)
-	}
-	return string(re.ReplaceAllString(string(out), " "))
+
+	r := string(out)
+	r = strings.TrimRight(r, "\n")
+	return strings.Replace(r, "\n", " ", -1)
 }
 
 // https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
diff --git a/parser.go b/parser.go
index f461646..13da4df 100644
--- a/parser.go
+++ b/parser.go
@@ -134,7 +134,7 @@
 		if len(line) == 0 {
 			break
 		} else if line[0] == '\t' {
-			ast.cmds = append(ast.cmds, string(bytes.TrimSpace(line)))
+			ast.cmds = append(ast.cmds, string(bytes.TrimLeft(line, " \t")))
 		} else {
 			p.unreadLine(line)
 			break
diff --git a/test/shell.mk b/test/shell.mk
new file mode 100644
index 0000000..b9bc9c2
--- /dev/null
+++ b/test/shell.mk
@@ -0,0 +1,12 @@
+test:
+	echo $(shell pwd)
+	echo $(shell false)
+	echo $(shell  echo -e "\na \n  b 	\n " )
+	echo $(shell  echo -e "\na \n  b 	\n " )X
+	echo X$(shell  echo -e "\n\n" )Y
+	echo X$(shell  echo -e "a\n\n" )Y
+	echo X$(shell  echo -e "\n\nb" )Y
+	echo X$(shell  echo -e "\n\nb" )Y
+	echo X$(shell  echo -e "\n\n\nb" )Y
+	echo X$(shell  echo -e "   b" )Y
+	echo X$(shell  echo -e "b   " )Y
diff --git a/test/whitespace_in_cmd.mk b/test/whitespace_in_cmd.mk
new file mode 100644
index 0000000..2c67567
--- /dev/null
+++ b/test/whitespace_in_cmd.mk
@@ -0,0 +1,3 @@
+test:
+	  echo foo  
+		  echo bar