diff --git a/Makefile b/Makefile
index cdeda68cf2aa9082571366837a504fe80ef6c40e..7e4968fb2134d3b90206dbcd9a08a773c934399c 100644
--- a/Makefile
+++ b/Makefile
@@ -789,7 +789,7 @@ $(vmlinux-dirs): prepare scripts
 
 pattern = ".*/localversion[^~]*"
 string  = $(shell cat /dev/null \
-	   `find $(objtree) $(srctree) -maxdepth 1 -regex $(pattern) | sort`)
+	   `find $(objtree) $(srctree) -maxdepth 1 -regex $(pattern) | sort -u`)
 
 localver = $(subst $(space),, $(string) \
 			      $(patsubst "%",%,$(CONFIG_LOCALVERSION)))