Fix makevars (C|LD)FLAGS ordering

This better matches the order from cc/cc.go, so that any implicit
ordering behaves the same in Make and Soong.

Change-Id: I802d725f037a22c4b2f0ae28258af95efa37ce79
diff --git a/cc/makevars.go b/cc/makevars.go
index 3e72a7a..cdc8bcc 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -82,11 +82,11 @@
 	}
 
 	ctx.StrictSorted(makePrefix+"GLOBAL_CFLAGS", strings.Join([]string{
-		toolchain.ToolchainCflags(),
+		toolchain.Cflags(),
 		"${commonGlobalCflags}",
 		fmt.Sprintf("${%sGlobalCflags}", hod),
+		toolchain.ToolchainCflags(),
 		productExtraCflags,
-		toolchain.Cflags(),
 	}, " "))
 	ctx.StrictSorted(makePrefix+"GLOBAL_CONLYFLAGS", "")
 	ctx.StrictSorted(makePrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
@@ -94,9 +94,9 @@
 		toolchain.Cppflags(),
 	}, " "))
 	ctx.StrictSorted(makePrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
+		toolchain.Ldflags(),
 		toolchain.ToolchainLdflags(),
 		productExtraLdflags,
-		toolchain.Ldflags(),
 	}, " "))
 
 	if toolchain.ClangSupported() {
@@ -107,13 +107,12 @@
 		}
 
 		ctx.StrictSorted(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{
-			toolchain.ToolchainClangCflags(),
-			"${commonClangGlobalCflags}",
-			"${clangExtraCflags}",
-			fmt.Sprintf("${%sClangGlobalCflags}", hod),
-			productExtraCflags,
 			toolchain.ClangCflags(),
+			"${commonClangGlobalCflags}",
+			fmt.Sprintf("${%sClangGlobalCflags}", hod),
+			toolchain.ToolchainClangCflags(),
 			clangExtras,
+			productExtraCflags,
 		}, " "))
 		ctx.StrictSorted(clangPrefix+"GLOBAL_CONLYFLAGS", "${clangExtraConlyflags}")
 		ctx.StrictSorted(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
@@ -121,9 +120,9 @@
 			toolchain.ClangCppflags(),
 		}, " "))
 		ctx.StrictSorted(clangPrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
+			toolchain.ClangLdflags(),
 			toolchain.ToolchainClangLdflags(),
 			productExtraLdflags,
-			toolchain.ClangLdflags(),
 			clangExtras,
 		}, " "))
 	}