diff options
Diffstat (limited to 'cc/androidmk.go')
-rw-r--r-- | cc/androidmk.go | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go index 66dd83815..f1d329f9c 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -37,6 +37,7 @@ type AndroidMkContext interface { Os() android.OsType Host() bool useVndk() bool + vndkVersion() string static() bool inRecovery() bool } @@ -109,17 +110,7 @@ func (c *Module) AndroidMk() android.AndroidMkData { } c.subAndroidMk(&ret, c.installer) - if c.Target().NativeBridge == android.NativeBridgeEnabled { - ret.SubName += nativeBridgeSuffix - } - - if c.useVndk() && c.hasVendorVariant() { - // .vendor suffix is added only when we will have two variants: core and vendor. - // The suffix is not added for vendor-only module. - ret.SubName += vendorSuffix - } else if c.inRecovery() && !c.onlyInRecovery() { - ret.SubName += recoverySuffix - } + ret.SubName += c.Properties.SubName return ret } @@ -312,6 +303,33 @@ func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa androidMkWriteTestData(test.data, ctx, ret) } +func (fuzz *fuzzBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { + ctx.subAndroidMk(ret, fuzz.binaryDecorator) + + var fuzzFiles []string + for _, d := range fuzz.corpus { + rel := d.Rel() + path := d.String() + path = strings.TrimSuffix(path, rel) + fuzzFiles = append(fuzzFiles, path+":corpus/"+d.Base()) + } + + if fuzz.dictionary != nil { + path := strings.TrimSuffix(fuzz.dictionary.String(), fuzz.dictionary.Rel()) + fuzzFiles = append(fuzzFiles, path+":"+fuzz.dictionary.Base()) + } + + if len(fuzzFiles) > 0 { + ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { + fmt.Fprintln(w, "LOCAL_TEST_DATA := "+strings.Join(fuzzFiles, " ")) + }) + } + + ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { + fmt.Fprintln(w, "LOCAL_IS_FUZZ_TARGET := true") + }) +} + func (test *testLibrary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { ctx.subAndroidMk(ret, test.libraryDecorator) } @@ -332,11 +350,10 @@ func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.And } ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { - path := installer.path.RelPathString() - dir, file := filepath.Split(path) + path, file := filepath.Split(installer.path.ToMakePath().String()) stem, suffix, _ := android.SplitFileExt(file) fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix) - fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir)) + fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path) fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem) }) } @@ -357,7 +374,6 @@ func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { ret.Class = "SHARED_LIBRARIES" - ret.SubName = vendorSuffix ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { c.libraryDecorator.androidMkWriteExportedFlags(w) @@ -378,12 +394,11 @@ func (c *vndkPrebuiltLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *andr ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { c.libraryDecorator.androidMkWriteExportedFlags(w) - path := c.path.RelPathString() - dir, file := filepath.Split(path) + path, file := filepath.Split(c.path.ToMakePath().String()) stem, suffix, ext := android.SplitFileExt(file) fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext) fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix) - fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir)) + fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path) fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem) }) } |