build: make: Use block model for Android.mk

This commit is contained in:
Danny Lin 2021-11-09 22:02:49 -08:00
parent 40404ef78e
commit adcfa688f2

View file

@ -47,10 +47,16 @@ export function blobToFileCopy(entry: BlobEntry, proprietaryDir: string) {
}
export function serializeModulesMakefile(mk: ModulesMakefile) {
let symlinkModules = mk.symlinks.map(link => {
let blocks = [
MAKEFILE_HEADER,
'LOCAL_PATH := $(call my-dir)',
`ifeq ($(TARGET_DEVICE),${mk.device})`,
]
for (let link of mk.symlinks) {
let destPath = partPathToMakePath(link.linkPartition, link.linkSubpath)
return `include $(CLEAR_VARS)
blocks.push(`include $(CLEAR_VARS)
LOCAL_MODULE := ${link.moduleName}
LOCAL_MODULE_CLASS := FAKE
LOCAL_MODULE_TAGS := optional
@ -64,17 +70,11 @@ $(LOCAL_BUILT_MODULE):
\t@rm -rf $@
\t@rm -rf $(SYMLINK)
\t$(hide) ln -sf $(TARGET) $(SYMLINK)
\t$(hide) touch $@`
})
\t$(hide) touch $@`)
}
return `${MAKEFILE_HEADER}
ifeq ($(TARGET_DEVICE),${mk.device})
${symlinkModules.join('\n\n')}
endif
`
blocks.push('endif')
return blocks.join('\n\n')
}
function addContBlock(blocks: Array<string>, variable: String, items: Array<string> | undefined) {