diff options
author | Colin Cross <ccross@android.com> | 2016-06-01 17:09:44 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-06-02 17:37:02 -0700 |
commit | 54c7112c4325426eabda5fa96a8d3c4f61cb8cc7 (patch) | |
tree | bc8a80430fa87b0f772e04430f2c96dcd4a85482 /android/androidmk.go | |
parent | 0fda89f4a80223d0adb01e0f44a0575c83956ea0 (diff) | |
download | build_soong-54c7112c4325426eabda5fa96a8d3c4f61cb8cc7.tar.gz build_soong-54c7112c4325426eabda5fa96a8d3c4f61cb8cc7.tar.bz2 build_soong-54c7112c4325426eabda5fa96a8d3c4f61cb8cc7.zip |
Simplify arch target handling
Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.
Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android. Store Os+Arch as a single Target.
Change-Id: Iae677eff61a851b65a7192a47f2dc17c1abb4160
Diffstat (limited to 'android/androidmk.go')
-rw-r--r-- | android/androidmk.go | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/android/androidmk.go b/android/androidmk.go index 603b37de..8d2951db 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -149,27 +149,21 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b name += "_" + data.SubName } - hostCross := false - if amod.Host() && amod.HostType() != CurrentHostType() { - hostCross = true - } - if data.Custom != nil { prefix := "" - if amod.Host() { - if hostCross { - prefix = "HOST_CROSS_" - } else { - prefix = "HOST_" - } - if amod.Arch().ArchType != ctx.Config().(Config).HostArches[amod.HostType()][0].ArchType { - prefix = "2ND_" + prefix - } - } else { + switch amod.Os().Class { + case Host: + prefix = "HOST_" + case HostCross: + prefix = "HOST_CROSS_" + case Device: prefix = "TARGET_" - if amod.Arch().ArchType != ctx.Config().(Config).DeviceArches[0].ArchType { - prefix = "2ND_" + prefix - } + + } + + config := ctx.Config().(Config) + if amod.Arch().ArchType != config.Targets[amod.Os().Class][0].Arch.ArchType { + prefix = "2ND_" + prefix } return data.Custom(w, name, prefix) @@ -191,15 +185,15 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", data.OutputFile.String()) archStr := amod.Arch().ArchType.String() - if amod.Host() { - if hostCross { - fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr) - } else { - fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr) - } - fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", amod.HostType().String()) - fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true") - } else { + host := false + switch amod.Os().Class { + case Host: + fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr) + host = true + case HostCross: + fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr) + host = true + case Device: fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr) if len(amod.commonProperties.Logtags) > 0 { @@ -207,6 +201,11 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b } } + if host { + fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", amod.Os().String()) + fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true") + } + for _, extra := range data.Extra { err = extra(w, data.OutputFile.Path()) if err != nil { |