From 842ec4b481513ea54f829132ec2fe842c1c6dbc5 Mon Sep 17 00:00:00 2001 From: Gorilla Sapiens Date: Thu, 29 May 2025 14:26:25 +0000 Subject: [PATCH] tmpfiles for the *.grc -> *.s -> *.o -> exe path --- src/cl65/main.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index 8d8aac932..d68e7c7e7 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -378,6 +378,14 @@ static void CmdSetOutput (CmdDesc* Cmd, const char* File) +static void CmdSetAsmOutput (CmdDesc* Cmd, const char* File) +/* Set the output asm file in a command desc for grc65 */ +{ + CmdAddArg2 (Cmd, "-s", File); +} + + + static void CmdSetTarget (CmdDesc* Cmd, target_t Target) /* Set the output file in a command desc */ { @@ -703,6 +711,9 @@ static void Compile (const char* File) static void CompileRes (const char* File) /* Compile the given geos resource file */ { + /* tmp Asm file name, if needed */ + char* AsmName = NULL; + /* Remember the current assembler argument count */ unsigned ArgCount = GRC.ArgCount; @@ -711,6 +722,14 @@ static void CompileRes (const char* File) */ CmdSetTarget (&GRC, Target); + /* Changes to output file name must come + ** BEFORE adding the file + */ + if (DoAssemble && DoLink) { + AsmName = MakeTmpFilename(".s"); + CmdSetAsmOutput(&GRC, AsmName); + } + /* Add the file as argument for the resource compiler */ CmdAddArg (&GRC, File); @@ -728,7 +747,10 @@ static void CompileRes (const char* File) */ if (DoAssemble) { /* Assemble the intermediate file and remove it */ - AssembleIntermediate (File, NULL); + AssembleIntermediate (File, AsmName); + if (AsmName) { + xfree(AsmName); + } } }