diff --git a/src/build/make.ts b/src/build/make.ts index 2b094e6..12957a3 100644 --- a/src/build/make.ts +++ b/src/build/make.ts @@ -36,6 +36,14 @@ export interface BoardMakefile { boardInfo?: string } +function startBlocks() { + return [MAKEFILE_HEADER] +} + +function finishBlocks(blocks: Array) { + return blocks.join('\n\n') + '\n' +} + export function sanitizeBasename(path: string) { return basename(path).replaceAll(/[^a-z0-9_\-.]/g, '_') } @@ -51,11 +59,11 @@ export function blobToFileCopy(entry: BlobEntry, proprietaryDir: string) { } export function serializeModulesMakefile(mk: ModulesMakefile) { - let blocks = [ - MAKEFILE_HEADER, + let blocks = startBlocks() + blocks.push( 'LOCAL_PATH := $(call my-dir)', `ifeq ($(TARGET_DEVICE),${mk.device})`, - ] + ) if (mk.radioFiles != undefined) { blocks.push(mk.radioFiles.map(img => `$(call add-radio-file,${img})`).join('\n')) @@ -82,7 +90,7 @@ $(LOCAL_BUILT_MODULE): } blocks.push('endif') - return blocks.join('\n\n') + return finishBlocks(blocks) } function addContBlock(blocks: Array, variable: String, items: Array | undefined) { @@ -93,7 +101,7 @@ function addContBlock(blocks: Array, variable: String, items: Array