blob: 2114031f68d4dc9cb8896d3f1355a774a45afa9d [file] [log] [blame]
Dan Willemsen218f6562015-07-08 18:13:11 -07001// Copyright 2015 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package cc
16
17import (
Dan Willemsen97750522016-02-09 17:43:51 -080018 "fmt"
Dan Willemsen218f6562015-07-08 18:13:11 -070019 "io"
Colin Crossa2344662016-03-24 13:14:12 -070020 "path/filepath"
Dan Willemsen218f6562015-07-08 18:13:11 -070021 "strings"
22
Colin Cross635c3b02016-05-18 15:37:25 -070023 "android/soong/android"
Dan Willemsen218f6562015-07-08 18:13:11 -070024)
25
Jiyong Park27b188b2017-07-18 13:23:39 +090026var (
27 vendorSuffix = ".vendor"
28)
29
Dan Willemsenf2c27d72016-07-13 16:50:22 -070030type AndroidMkContext interface {
31 Target() android.Target
Colin Crossb916a382016-07-29 17:28:03 -070032 subAndroidMk(*android.AndroidMkData, interface{})
Jeff Gaston7b6118b2017-10-04 21:07:42 +000033 vndk() bool
Colin Crossb916a382016-07-29 17:28:03 -070034}
35
36type subAndroidMkProvider interface {
37 AndroidMk(AndroidMkContext, *android.AndroidMkData)
38}
39
40func (c *Module) subAndroidMk(data *android.AndroidMkData, obj interface{}) {
41 if c.subAndroidMkOnce == nil {
42 c.subAndroidMkOnce = make(map[subAndroidMkProvider]bool)
43 }
44 if androidmk, ok := obj.(subAndroidMkProvider); ok {
45 if !c.subAndroidMkOnce[androidmk] {
46 c.subAndroidMkOnce[androidmk] = true
47 androidmk.AndroidMk(c, data)
48 }
49 }
Dan Willemsenf2c27d72016-07-13 16:50:22 -070050}
51
Colin Crossa18e9cf2017-08-10 17:00:19 -070052func (c *Module) AndroidMk() android.AndroidMkData {
Colin Crossbc6fb162016-05-24 15:39:04 -070053 if c.Properties.HideFromMake {
Colin Crossa18e9cf2017-08-10 17:00:19 -070054 return android.AndroidMkData{
55 Disabled: true,
56 }
Colin Crossbc6fb162016-05-24 15:39:04 -070057 }
58
Colin Crossa18e9cf2017-08-10 17:00:19 -070059 ret := android.AndroidMkData{
60 OutputFile: c.outputFile,
61 Extra: []android.AndroidMkExtraFunc{
62 func(w io.Writer, outputFile android.Path) {
63 fmt.Fprintln(w, "LOCAL_SANITIZE := never")
64 if len(c.Properties.AndroidMkSharedLibs) > 0 {
65 fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
66 }
Jeff Gaston7b6118b2017-10-04 21:07:42 +000067 if c.Target().Os == android.Android && c.Properties.Sdk_version != "" && !c.vndk() {
Colin Crossa18e9cf2017-08-10 17:00:19 -070068 fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version)
69 fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
70 } else {
71 // These are already included in LOCAL_SHARED_LIBRARIES
72 fmt.Fprintln(w, "LOCAL_CXX_STL := none")
73 }
Jeff Gaston7b6118b2017-10-04 21:07:42 +000074 if c.vndk() {
Colin Crossa18e9cf2017-08-10 17:00:19 -070075 fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
76 }
77 },
78 },
79 }
Colin Crossca860ac2016-01-04 14:34:37 -080080
Colin Crossca860ac2016-01-04 14:34:37 -080081 for _, feature := range c.features {
Colin Crossb916a382016-07-29 17:28:03 -070082 c.subAndroidMk(&ret, feature)
Colin Crossca860ac2016-01-04 14:34:37 -080083 }
84
Colin Crossb916a382016-07-29 17:28:03 -070085 c.subAndroidMk(&ret, c.compiler)
86 c.subAndroidMk(&ret, c.linker)
Colin Cross8ff9ef42017-05-08 13:44:11 -070087 if c.sanitize != nil {
88 c.subAndroidMk(&ret, c.sanitize)
89 }
Colin Crossb916a382016-07-29 17:28:03 -070090 c.subAndroidMk(&ret, c.installer)
Colin Crossca860ac2016-01-04 14:34:37 -080091
Jiyong Park82e2bf32017-08-16 14:05:54 +090092 if c.vndk() && c.hasVendorVariant() {
Jiyong Park27b188b2017-07-18 13:23:39 +090093 // .vendor suffix is added only when we will have two variants: core and vendor.
94 // The suffix is not added for vendor-only module.
95 ret.SubName += vendorSuffix
Dan Willemsen4416e5d2017-04-06 12:43:22 -070096 }
97
Colin Crossa18e9cf2017-08-10 17:00:19 -070098 return ret
Colin Crossca860ac2016-01-04 14:34:37 -080099}
100
Anders Lewisb97e8182017-07-14 15:20:13 -0700101func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, ret *android.AndroidMkData) {
102 var testFiles []string
103 for _, d := range data {
104 rel := d.Rel()
105 path := d.String()
106 if !strings.HasSuffix(path, rel) {
107 panic(fmt.Errorf("path %q does not end with %q", path, rel))
108 }
109 path = strings.TrimSuffix(path, rel)
110 testFiles = append(testFiles, path+":"+rel)
111 }
112 if len(testFiles) > 0 {
Colin Cross27a4b052017-08-10 16:32:23 -0700113 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Anders Lewisb97e8182017-07-14 15:20:13 -0700114 fmt.Fprintln(w, "LOCAL_TEST_DATA := "+strings.Join(testFiles, " "))
Anders Lewisb97e8182017-07-14 15:20:13 -0700115 })
116 }
117}
118
Dan Willemsen58539402017-03-19 13:44:32 -0700119func (library *libraryDecorator) androidMkWriteExportedFlags(w io.Writer) {
120 exportedFlags := library.exportedFlags()
121 if len(exportedFlags) > 0 {
122 fmt.Fprintln(w, "LOCAL_EXPORT_CFLAGS :=", strings.Join(exportedFlags, " "))
Dan Willemsend5781342017-02-15 16:15:21 -0800123 }
Dan Willemsen58539402017-03-19 13:44:32 -0700124 exportedFlagsDeps := library.exportedFlagsDeps()
125 if len(exportedFlagsDeps) > 0 {
126 fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DEPS :=", strings.Join(exportedFlagsDeps.Strings(), " "))
127 }
128}
Dan Willemsend5781342017-02-15 16:15:21 -0800129
Dan Willemsen58539402017-03-19 13:44:32 -0700130func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
Dan Willemsend5781342017-02-15 16:15:21 -0800131 if library.static() {
132 ret.Class = "STATIC_LIBRARIES"
133 } else if library.shared() {
134 ctx.subAndroidMk(ret, &library.stripper)
135 ctx.subAndroidMk(ret, &library.relocationPacker)
136
137 ret.Class = "SHARED_LIBRARIES"
138 } else if library.header() {
Colin Cross0f86d182017-08-10 17:07:28 -0700139 ret.Custom = func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
Dan Willemsend5781342017-02-15 16:15:21 -0800140 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
141 fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
Colin Cross0f86d182017-08-10 17:07:28 -0700142 fmt.Fprintln(w, "LOCAL_MODULE :=", name+data.SubName)
Dan Willemsend5781342017-02-15 16:15:21 -0800143
144 archStr := ctx.Target().Arch.ArchType.String()
145 var host bool
146 switch ctx.Target().Os.Class {
147 case android.Host:
148 fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH := ", archStr)
149 host = true
150 case android.HostCross:
151 fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH := ", archStr)
152 host = true
153 case android.Device:
154 fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH := ", archStr)
155 }
156
157 if host {
Dan Willemsen866b5632017-09-22 12:28:24 -0700158 makeOs := ctx.Target().Os.String()
159 if ctx.Target().Os == android.Linux || ctx.Target().Os == android.LinuxBionic {
160 makeOs = "linux"
161 }
162 fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", makeOs)
Dan Willemsend5781342017-02-15 16:15:21 -0800163 fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
Jeff Gaston7b6118b2017-10-04 21:07:42 +0000164 } else if ctx.vndk() {
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700165 fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
Dan Willemsend5781342017-02-15 16:15:21 -0800166 }
167
Dan Willemsen58539402017-03-19 13:44:32 -0700168 library.androidMkWriteExportedFlags(w)
Dan Willemsend5781342017-02-15 16:15:21 -0800169 fmt.Fprintln(w, "include $(BUILD_HEADER_LIBRARY)")
Dan Willemsend5781342017-02-15 16:15:21 -0800170 }
171
172 return
173 }
174
Colin Cross27a4b052017-08-10 16:32:23 -0700175 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Dan Willemsen58539402017-03-19 13:44:32 -0700176 library.androidMkWriteExportedFlags(w)
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800177 fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES := ")
178 if library.sAbiOutputFile.Valid() {
179 fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES += ", library.sAbiOutputFile.String())
180 if library.sAbiDiff.Valid() && !library.static() {
181 fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES += ", library.sAbiDiff.String())
Jayant Chowdhary715cac32017-04-20 06:53:59 -0700182 fmt.Fprintln(w, "HEADER_ABI_DIFFS += ", library.sAbiDiff.String())
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800183 }
184 }
Dan Willemsen218f6562015-07-08 18:13:11 -0700185
Dan Willemsen1d577e22016-08-29 15:53:15 -0700186 fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+outputFile.Ext())
Dan Willemsen218f6562015-07-08 18:13:11 -0700187
Dan Willemsen97750522016-02-09 17:43:51 -0800188 fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
Dan Willemsen218f6562015-07-08 18:13:11 -0700189
Dan Willemsen581341d2017-02-09 16:16:31 -0800190 if library.coverageOutputFile.Valid() {
191 fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
192 }
Colin Crossca860ac2016-01-04 14:34:37 -0800193 })
Colin Crossb916a382016-07-29 17:28:03 -0700194
Colin Cross4ac44802017-02-15 14:06:12 -0800195 if library.shared() {
Colin Crossb916a382016-07-29 17:28:03 -0700196 ctx.subAndroidMk(ret, library.baseInstaller)
197 }
Dan Willemsen218f6562015-07-08 18:13:11 -0700198}
199
Dan Willemsenf2c27d72016-07-13 16:50:22 -0700200func (object *objectLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
Colin Cross0f86d182017-08-10 17:07:28 -0700201 ret.Custom = func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
Colin Crossca860ac2016-01-04 14:34:37 -0800202 out := ret.OutputFile.Path()
Dan Willemsen218f6562015-07-08 18:13:11 -0700203
Colin Cross0f86d182017-08-10 17:07:28 -0700204 fmt.Fprintln(w, "\n$("+prefix+"OUT_INTERMEDIATE_LIBRARIES)/"+name+data.SubName+objectExtension+":", out.String())
Dan Willemsen97750522016-02-09 17:43:51 -0800205 fmt.Fprintln(w, "\t$(copy-file-to-target)")
Dan Willemsen218f6562015-07-08 18:13:11 -0700206 }
Dan Willemsen218f6562015-07-08 18:13:11 -0700207}
208
Colin Crossb916a382016-07-29 17:28:03 -0700209func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
Colin Cross1e7d3702016-08-24 15:25:47 -0700210 ctx.subAndroidMk(ret, binary.baseInstaller)
Colin Crossb916a382016-07-29 17:28:03 -0700211 ctx.subAndroidMk(ret, &binary.stripper)
Dan Willemsen7517ed02016-06-10 17:20:30 -0700212
Dan Willemsen218f6562015-07-08 18:13:11 -0700213 ret.Class = "EXECUTABLES"
Colin Cross27a4b052017-08-10 16:32:23 -0700214 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Dan Willemsen97750522016-02-09 17:43:51 -0800215 fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
Colin Crossb916a382016-07-29 17:28:03 -0700216 if Bool(binary.Properties.Static_executable) {
Colin Cross3854a602016-01-11 12:49:11 -0800217 fmt.Fprintln(w, "LOCAL_FORCE_STATIC_EXECUTABLE := true")
218 }
Colin Cross9b09f242016-12-07 13:37:42 -0800219
220 if len(binary.symlinks) > 0 {
221 fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS := "+strings.Join(binary.symlinks, " "))
222 }
223
Dan Willemsen581341d2017-02-09 16:16:31 -0800224 if binary.coverageOutputFile.Valid() {
225 fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", binary.coverageOutputFile.String())
226 }
Colin Crossca860ac2016-01-04 14:34:37 -0800227 })
228}
229
Colin Crossb916a382016-07-29 17:28:03 -0700230func (benchmark *benchmarkDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
231 ctx.subAndroidMk(ret, benchmark.binaryDecorator)
Dan Willemsen58a5c8b2017-05-23 15:10:37 -0700232 ret.Class = "NATIVE_TESTS"
Colin Cross27a4b052017-08-10 16:32:23 -0700233 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Colin Crosse28f4e22017-04-24 18:10:29 -0700234 if len(benchmark.Properties.Test_suites) > 0 {
235 fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
236 strings.Join(benchmark.Properties.Test_suites, " "))
237 }
Colin Crosse28f4e22017-04-24 18:10:29 -0700238 })
Anders Lewisb97e8182017-07-14 15:20:13 -0700239
240 androidMkWriteTestData(benchmark.data, ctx, ret)
Colin Crossb916a382016-07-29 17:28:03 -0700241}
242
243func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
244 ctx.subAndroidMk(ret, test.binaryDecorator)
Dan Willemsen0fe72532017-01-17 13:25:49 -0800245 ret.Class = "NATIVE_TESTS"
Colin Crossb916a382016-07-29 17:28:03 -0700246 if Bool(test.Properties.Test_per_src) {
247 ret.SubName = "_" + test.binaryDecorator.Properties.Stem
Colin Crossa2344662016-03-24 13:14:12 -0700248 }
Colin Crossfaeb7aa2017-02-01 14:12:44 -0800249
Colin Cross27a4b052017-08-10 16:32:23 -0700250 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Colin Crossa929db02017-03-27 16:27:50 -0700251 if len(test.Properties.Test_suites) > 0 {
Dan Shi4df566d2017-04-03 12:29:25 -0700252 fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
Colin Crossa929db02017-03-27 16:27:50 -0700253 strings.Join(test.Properties.Test_suites, " "))
254 }
Colin Crossa929db02017-03-27 16:27:50 -0700255 })
256
Anders Lewisb97e8182017-07-14 15:20:13 -0700257 androidMkWriteTestData(test.data, ctx, ret)
Colin Crossa2344662016-03-24 13:14:12 -0700258}
259
Colin Crossb916a382016-07-29 17:28:03 -0700260func (test *testLibrary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
261 ctx.subAndroidMk(ret, test.libraryDecorator)
262}
Dan Willemsene7932e82016-05-16 15:56:53 -0700263
Colin Crossb916a382016-07-29 17:28:03 -0700264func (library *toolchainLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
265 ret.Class = "STATIC_LIBRARIES"
Colin Cross27a4b052017-08-10 16:32:23 -0700266 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Dan Willemsene7932e82016-05-16 15:56:53 -0700267 fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+outputFile.Ext())
Dan Willemsene7932e82016-05-16 15:56:53 -0700268 fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
Dan Willemsene7932e82016-05-16 15:56:53 -0700269 })
270}
271
Dan Willemsenf2c27d72016-07-13 16:50:22 -0700272func (stripper *stripper) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
273 // Make only supports stripping target modules
274 if ctx.Target().Os != android.Android {
275 return
276 }
277
Colin Cross27a4b052017-08-10 16:32:23 -0700278 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Dan Willemsen7517ed02016-06-10 17:20:30 -0700279 if stripper.StripProperties.Strip.None {
280 fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
281 } else if stripper.StripProperties.Strip.Keep_symbols {
282 fmt.Fprintln(w, "LOCAL_STRIP_MODULE := keep_symbols")
Dan Willemsenf2c27d72016-07-13 16:50:22 -0700283 } else {
284 fmt.Fprintln(w, "LOCAL_STRIP_MODULE := mini-debug-info")
Dan Willemsen7517ed02016-06-10 17:20:30 -0700285 }
Dan Willemsen7517ed02016-06-10 17:20:30 -0700286 })
287}
288
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700289func (packer *relocationPacker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
Colin Cross27a4b052017-08-10 16:32:23 -0700290 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700291 if packer.Properties.PackingRelocations {
292 fmt.Fprintln(w, "LOCAL_PACK_MODULE_RELOCATIONS := true")
293 }
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700294 })
295}
296
Dan Willemsenf2c27d72016-07-13 16:50:22 -0700297func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
Dan Willemsen03ce63e2016-09-29 12:17:49 -0700298 // Soong installation is only supported for host modules. Have Make
299 // installation trigger Soong installation.
300 if ctx.Target().Os.Class == android.Host {
301 ret.OutputFile = android.OptionalPathForPath(installer.path)
302 }
303
Colin Cross27a4b052017-08-10 16:32:23 -0700304 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Colin Crossa2344662016-03-24 13:14:12 -0700305 path := installer.path.RelPathString()
Colin Crossbf305de2016-03-29 17:32:06 -0700306 dir, file := filepath.Split(path)
307 stem := strings.TrimSuffix(file, filepath.Ext(file))
Dan Willemsen1d577e22016-08-29 15:53:15 -0700308 fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+filepath.Ext(file))
Colin Crosse14388b2016-05-03 14:08:40 -0700309 fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
Colin Crossbf305de2016-03-29 17:32:06 -0700310 fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
Colin Crossa2344662016-03-24 13:14:12 -0700311 })
Dan Willemsen218f6562015-07-08 18:13:11 -0700312}
Dan Albert914449f2016-06-17 16:45:24 -0700313
Colin Crossb916a382016-07-29 17:28:03 -0700314func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
Dan Willemsen01a90592017-04-07 15:21:13 -0700315 ret.SubName = ndkLibrarySuffix + "." + c.properties.ApiLevel
Dan Albert705c84b2016-08-08 10:45:03 -0700316 ret.Class = "SHARED_LIBRARIES"
Dan Albert914449f2016-06-17 16:45:24 -0700317
Colin Cross27a4b052017-08-10 16:32:23 -0700318 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Colin Crossb916a382016-07-29 17:28:03 -0700319 path, file := filepath.Split(c.installPath)
Dan Albert914449f2016-06-17 16:45:24 -0700320 stem := strings.TrimSuffix(file, filepath.Ext(file))
Dan Albertcdd4c242016-08-08 14:44:56 -0700321 fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
322 fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+outputFile.Ext())
Dan Albert914449f2016-06-17 16:45:24 -0700323 fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path)
324 fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
Dan Willemsen866810d2017-04-04 14:13:45 -0700325 fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
Dan Albert914449f2016-06-17 16:45:24 -0700326
327 // Prevent make from installing the libraries to obj/lib (since we have
328 // dozens of libraries with the same name, they'll clobber each other
329 // and the real versions of the libraries from the platform).
330 fmt.Fprintln(w, "LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES := false")
Dan Albert914449f2016-06-17 16:45:24 -0700331 })
332}
Dan Willemsenb916b802017-03-19 13:44:32 -0700333
334func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
335 ret.Class = "SHARED_LIBRARIES"
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700336 ret.SubName = ".vendor"
Dan Willemsenb916b802017-03-19 13:44:32 -0700337
Colin Cross27a4b052017-08-10 16:32:23 -0700338 ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
Dan Willemsenb916b802017-03-19 13:44:32 -0700339 c.libraryDecorator.androidMkWriteExportedFlags(w)
340
341 fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+outputFile.Ext())
342 fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
343 fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
344 fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
345 fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700346 fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
Dan Willemsenb916b802017-03-19 13:44:32 -0700347 })
348}