Clean OUT_DIR

Otherwise Make and soong_ui disagree about where the soong.variables
file should be. For example, when "OUT_DIR=out/":

Error dumping make vars: Failed to parse make line: "make: Nothing to be done for `out/soong/soong.variables'."

We would need to pass out//soong/soong.variables into make, since it
doesn't attempt to match clean/unclean paths.

Bug: 37553659
Test: OUT_DIR=out/ m -j
Change-Id: Iebeea4868b96b11e8b08735f272e22be5db1d701
diff --git a/ui/build/config.go b/ui/build/config.go
index e21e1fa..e677d93 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -51,7 +51,9 @@
 	}
 
 	// Make sure OUT_DIR is set appropriately
-	if _, ok := ret.environ.Get("OUT_DIR"); !ok {
+	if outDir, ok := ret.environ.Get("OUT_DIR"); ok {
+		ret.environ.Set("OUT_DIR", filepath.Clean(outDir))
+	} else {
 		outDir := "out"
 		if baseDir, ok := ret.environ.Get("OUT_DIR_COMMON_BASE"); ok {
 			if wd, err := os.Getwd(); err != nil {