diff --git a/Makefile b/Makefile
index b1a9d6e90a012005bc02d7f2a243df517f7690a8..7fd3c803fe85b4f949b29d5c82b5abd6a3026eec 100644
--- a/Makefile
+++ b/Makefile
@@ -177,7 +177,7 @@ ifeq ($(OSARCH),OpenBSD)
 endif
 
 ifeq ($(OSARCH),SunOS)
-  ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
+  ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
 endif
 
 ASTERISKVERSION:=$(shell build_tools/make_version .)
diff --git a/agi/Makefile b/agi/Makefile
index e65357c5cfd323b29f5e24ed64d8ab8dd2199d68..a6c52c918297c64bbf17df1fee75d307c3b4c4b4 100644
--- a/agi/Makefile
+++ b/agi/Makefile
@@ -16,7 +16,7 @@
 AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
 
 ifeq ($(OSARCH),SunOS)
-  LIBS+=-lsocket -lnsl ../strcompat.o
+  LIBS+=-lsocket -lnsl ../main/strcompat.o
 endif
 
 include $(ASTTOPDIR)/Makefile.rules
diff --git a/build_tools/make_version b/build_tools/make_version
index b943f03b9dcc544ec614a164ff94fc67dea883b3..ace522159941d86c7b0bed4a2546e31bd7b1e0b7 100755
--- a/build_tools/make_version
+++ b/build_tools/make_version
@@ -5,7 +5,7 @@ if [ -f ${1}/.version ]; then
 elif [ -f ${1}/.svnrevision ]; then
 	echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision`
 elif [ -d .svn ]; then
-    PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/asterisk/:: | sed -e 's:/: :g'`
+    PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e 's:^.*/svn/asterisk/::' | sed -e 's:/: :g'`
     BRANCH=0
     TEAM=0
     
diff --git a/main/db1-ast/Makefile b/main/db1-ast/Makefile
index 5a9f29cde17eee7a397a8aa67b88218b6da12596..3e5a6fb2d8c66aae474604934cbea79fdbb1dee8 100644
--- a/main/db1-ast/Makefile
+++ b/main/db1-ast/Makefile
@@ -54,7 +54,7 @@ CFLAGS+=-Wall -D__DBINTERFACE_PRIVATE -I. -I.. -Iinclude -Ihash -Ibtree -Irecno
 
 OSTYPE=$(shell uname -s)
 ifeq ($(OSTYPE),SunOS)
-CFLAGS+=-I../include -I../include/solaris-compat -DSOLARIS
+CFLAGS+=-I../../include -I../../include/solaris-compat -DSOLARIS
 endif
 
 db_dump185.o: db_dump185.c
diff --git a/main/editline/Makefile.in b/main/editline/Makefile.in
index 805642281a54f74db70eb4e76899cde134d1e2b1..1b464861769b5c7a73eb771e8fffc38819249a49 100644
--- a/main/editline/Makefile.in
+++ b/main/editline/Makefile.in
@@ -27,7 +27,7 @@ INSTALL = @INSTALL@
 PREFIX = @prefix@
 
 ifeq ($(OSTYPE),SunOS)
-CFLAGS+=-DSOLARIS -I../include/solaris-compat
+CFLAGS+=-DSOLARIS -I../../include/solaris-compat
 endif
 
 # .c files.