androidmk: support conditionals on HOST_OS == linux
Add HOST_OS == linux to the supported conditionals, and replace
a manual list with a map lookup.
Change-Id: I0c26e3a854d1011870f41c05fc400d68334cd45f
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 7fd9919..71c5832 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -87,10 +87,12 @@
class string
suffix string
}{
- "($(HOST_OS),darwin)": {"host_os", "darwin"},
- "($(HOST_OS), darwin)": {"host_os", "darwin"},
- "($(HOST_OS),windows)": {"host_os", "windows"},
- "($(HOST_OS), windows)": {"host_os", "windows"},
+ "($(HOST_OS),darwin)": {"target", "darwin"},
+ "($(HOST_OS), darwin)": {"target", "darwin"},
+ "($(HOST_OS),windows)": {"target", "windows"},
+ "($(HOST_OS), windows)": {"target", "windows"},
+ "($(HOST_OS),linux)": {"target", "linux"},
+ "($(HOST_OS), linux)": {"target", "linux"},
}
func mydir(args []string) string {
diff --git a/androidmk/cmd/androidmk/androidmk.go b/androidmk/cmd/androidmk/androidmk.go
index 03888fe..22b29b2 100644
--- a/androidmk/cmd/androidmk/androidmk.go
+++ b/androidmk/cmd/androidmk/androidmk.go
@@ -125,9 +125,7 @@
case "ifeq", "ifneq":
args := directive.Args.Dump()
eq := directive.Name == "ifeq"
- switch args {
- case "($(HOST_OS),windows)", "($(HOST_OS), windows)",
- "($(HOST_OS),darwin)", "($(HOST_OS), darwin)":
+ if _, ok := conditionalTranslations[args]; ok {
newCond := conditional{args, eq}
conds = append(conds, &newCond)
if cond == nil {
@@ -135,7 +133,7 @@
} else {
file.errorf(directive, "unsupported nested conditional")
}
- default:
+ } else {
file.errorf(directive, "unsupported conditional")
conds = append(conds, nil)
continue