aboutsummaryrefslogtreecommitdiffstats
path: root/android/androidmk.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/androidmk.go')
-rw-r--r--android/androidmk.go53
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 {