diff options
author | Dan Willemsen <dwillemsen@google.com> | 2017-09-09 01:15:26 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2017-09-09 13:06:25 -0700 |
commit | 4f1c3d41161ce9f8069aec8d491d233d865914e0 (patch) | |
tree | 936ed57e83f4762017b24e0359bde645c43b98b4 /cc/gen.go | |
parent | ace7a6ba43fea035e3189085184da4c2e6fb287c (diff) | |
download | build_soong-4f1c3d41161ce9f8069aec8d491d233d865914e0.tar.gz build_soong-4f1c3d41161ce9f8069aec8d491d233d865914e0.tar.bz2 build_soong-4f1c3d41161ce9f8069aec8d491d233d865914e0.zip |
Add support for Windows Message Compiler
We've only got one user of this currently, but since it needs the
location of the toolchain, and different flags based on 32 vs 64-bit,
it's easier just to add support than to get this into a genrule.
Test: Convert external/mdnsresponder to Soong, build
Change-Id: I6c19a82bc14f6ab556f6cc5f37164862ba5f9083
Diffstat (limited to 'cc/gen.go')
-rw-r--r-- | cc/gen.go | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -54,6 +54,13 @@ var ( Deps: blueprint.DepsGCC, }, "aidlFlags", "outDir") + + windmc = pctx.AndroidStaticRule("windmc", + blueprint.RuleParams{ + Command: "$windmcCmd -r$$(dirname $out) -h$$(dirname $out) $in", + CommandDeps: []string{"$windmcCmd"}, + }, + "windmcCmd") ) func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.ModuleGenPath, yaccFlags string) (headerFile android.ModuleGenPath) { @@ -100,6 +107,26 @@ func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.Mod }) } +func genWinMsg(ctx android.ModuleContext, srcFile android.Path, flags builderFlags) (android.Path, android.Path) { + headerFile := android.GenPathWithExt(ctx, "windmc", srcFile, "h") + rcFile := android.GenPathWithExt(ctx, "windmc", srcFile, "rc") + + windmcCmd := gccCmd(flags.toolchain, "windmc") + + ctx.ModuleBuild(pctx, android.ModuleBuildParams{ + Rule: windmc, + Description: "windmc " + srcFile.Rel(), + Output: rcFile, + ImplicitOutput: headerFile, + Input: srcFile, + Args: map[string]string{ + "windmcCmd": windmcCmd, + }, + }) + + return rcFile, headerFile +} + func genSources(ctx android.ModuleContext, srcFiles android.Paths, buildFlags builderFlags) (android.Paths, android.Paths) { @@ -137,6 +164,10 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths, cppFile := rsGeneratedCppFile(ctx, srcFile) rsFiles = append(rsFiles, srcFiles[i]) srcFiles[i] = cppFile + case ".mc": + rcFile, headerFile := genWinMsg(ctx, srcFile, buildFlags) + srcFiles[i] = rcFile + deps = append(deps, headerFile) } } |