| 50 | }; |
| 51 | |
| 52 | export class MakeFile extends FILE { |
| 53 | constructor(path) { |
| 54 | super(path) |
| 55 | } |
| 56 | echo(tool, ...strings) { |
| 57 | if (tool.windows) |
| 58 | this.write("\t@echo # "); |
| 59 | else |
| 60 | this.write("\t@echo '# "); |
| 61 | for (var string of strings) |
| 62 | this.write(string); |
| 63 | if (tool.windows) |
| 64 | this.write("\n"); |
| 65 | else |
| 66 | this.write("'\n"); |
| 67 | } |
| 68 | escapePathSpaces(path) { |
| 69 | return path.replace(/ /g, "\\ ") |
| 70 | } |
| 71 | generate(tool) { |
| 72 | this.generateDefinitions(tool); |
| 73 | if (tool.environment?.MAKE_FRAGMENT) // override default .mk file |
| 74 | tool.fragmentPath = tool.environment.MAKE_FRAGMENT; |
| 75 | if (undefined === tool.fragmentPath) |
| 76 | throw new Error(`MAKE_FRAGMENT not found: unknown platform "${tool.platform}"!`); |
| 77 | |
| 78 | if (tool.platform == "zephyr") { |
| 79 | var prefixPath = tool.fragmentPath + ".prefix"; |
| 80 | this.write(tool.readFileString(prefixPath)); |
| 81 | } |
| 82 | |
| 83 | for (var result of tool.pioFiles) { |
| 84 | var source = result.source; |
| 85 | var target = result.target; |
| 86 | this.line("PIO_HEADERS += $(TMP_DIR)", tool.slash, target, ".pio.h"); |
| 87 | } |
| 88 | |
| 89 | if (tool.platform != "zephyr") { |
| 90 | this.write(tool.readFileString(tool.fragmentPath)); |
| 91 | } |
| 92 | this.line(""); |
| 93 | this.generateRules(tool) |
| 94 | if (tool.platform == "zephyr") { |
| 95 | if (tool.xsbugLaunch !== "log") { |
| 96 | let start_xsbug_command; |
| 97 | if (tool.currentPlatform === "mac") |
| 98 | start_xsbug_command = `open --env XSBUG_PROJECT=${tool.mainPath} -a ${tool.buildPath}/bin/mac/release/xsbug.app -g `; |
| 99 | else if (tool.currentPlatform == "win") |
| 100 | start_xsbug_command = "echo start xsbug"; |
| 101 | // start_xsbug_command = 'tasklist /nh /fi "imagename eq xsbug.exe" | find /i "xsbug.exe" > nul || (start ${NATIVE_XSBUG})'; |
| 102 | // start_xsbug_command = `cmd.exe /C xsbug`; |
| 103 | // start_xsbug_command = `${tool.buildPath}/devices/zephyr/config/win_start_xsbug`; |
| 104 | else // lin |
| 105 | start_xsbug_command = `env XSBUG_PROJECT=${tool.mainPath} ${tool.buildPath}/devices/zephyr/config/lin_start_xsbug`; |
| 106 | |
| 107 | this.line("execute_process("); |
| 108 | this.line(` COMMAND ${start_xsbug_command}`); |
| 109 | this.line(")"); |
nothing calls this directly
no outgoing calls
no test coverage detected