From adcfa688f2a9281c72e8c64982eae6ab14f6b447 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Tue, 9 Nov 2021 22:02:49 -0800 Subject: [PATCH] build: make: Use block model for Android.mk --- src/build/make.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/build/make.ts b/src/build/make.ts index 8e69511..a09d3dd 100644 --- a/src/build/make.ts +++ b/src/build/make.ts @@ -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, variable: String, items: Array | undefined) {