Support .asm files for assembly

Test: mmma -j external/libjpeg-turbo
Change-Id: Id192dae5d74ecbf500fc668931c37f9b91d25ca4
diff --git a/cc/builder.go b/cc/builder.go
index a568a29..ee53f41 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -158,6 +158,16 @@
 			Description: "tidy $out",
 		},
 		"cFlags", "tidyFlags")
+
+	yasmCmd = pctx.SourcePathVariable("yasmCmd", "prebuilts/misc/${config.HostPrebuiltTag}/yasm/yasm")
+
+	yasm = pctx.AndroidStaticRule("yasm",
+		blueprint.RuleParams{
+			Command:     "$yasmCmd $asFlags -o $out $in",
+			CommandDeps: []string{"$yasmCmd"},
+			Description: "yasm $out",
+		},
+		"asFlags")
 )
 
 func init() {
@@ -183,6 +193,7 @@
 	yaccFlags   string
 	protoFlags  string
 	tidyFlags   string
+	yasmFlags   string
 	toolchain   config.Toolchain
 	clang       bool
 	tidy        bool
@@ -240,6 +251,19 @@
 
 		objFiles[i] = objFile
 
+		if srcFile.Ext() == ".asm" {
+			ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+				Rule:      yasm,
+				Output:    objFile,
+				Input:     srcFile,
+				OrderOnly: deps,
+				Args: map[string]string{
+					"asFlags": flags.yasmFlags,
+				},
+			})
+			continue
+		}
+
 		var moduleCflags string
 		var ccCmd string
 		tidy := flags.tidy && flags.clang