Add the --color and --no-utf8 options to cl65 which will pass it to the tools

that understand it.
This commit is contained in:
Kugel Fuhr
2025-07-09 15:31:13 +02:00
parent 79967ff01b
commit 074a3f513e
2 changed files with 37 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ and other things.
---------------------------------------------------------------------------
Usage: cl65 [options] file [...]
Short options:
-c Compile and assemble but don't link
-c Compile and assemble, but don't link
-d Debug mode
-g Add debug info
-h Help (this text)
@@ -55,10 +55,10 @@ Short options:
-L path Specify a library search path
-Ln name Create a VICE label file
-O Optimize code
-Oi Optimize code, inline more code
-Oi Optimize code, inline runtime functions
-Or Optimize code, honour the register keyword
-Os Optimize code, inline standard functions
-S Compile but don't assemble and link
-Os Optimize code, inline known C functions
-S Compile, but don't assemble and link
-T Include source as comment
-V Print the version number
-W name[,...] Suppress compiler warnings
@@ -81,8 +81,9 @@ Long options:
--code-label name Define and export a CODE segment label
--code-name seg Set the name of the CODE segment
--codesize x Accept larger code by factor x
--color [on|auto|off] Color diagnostics (default: auto)
--config name Use linker config file
--cpu type Set cpu type
--cpu type Set CPU type
--create-dep name Create a make dependency file
--create-full-dep name Create a full make dependency file
--data-label name Define and export a DATA segment label
@@ -101,8 +102,9 @@ Long options:
--mapfile name Create a map file
--memory-model model Set the memory model
--module Link as a module
--module-id id Specify a module id for the linker
--module-id id Specify a module ID for the linker
--no-target-lib Don't link the target library
--no-utf8 Disable use of UTF-8 in diagnostics
--o65-model model Override the o65 model
--obj file Link this object file
--obj-path path Specify an object file search path

View File

@@ -70,6 +70,7 @@
/* common */
#include "attrib.h"
#include "cmdline.h"
#include "consprop.h"
#include "filetype.h"
#include "fname.h"
#include "mmodel.h"
@@ -858,6 +859,7 @@ static void Usage (void)
" --code-label name\t\tDefine and export a CODE segment label\n"
" --code-name seg\t\tSet the name of the CODE segment\n"
" --codesize x\t\t\tAccept larger code by factor x\n"
" --color [on|auto|off]\t\tColor diagnostics (default: auto)\n"
" --config name\t\t\tUse linker config file\n"
" --cpu type\t\t\tSet CPU type\n"
" --create-dep name\t\tCreate a make dependency file\n"
@@ -880,6 +882,7 @@ static void Usage (void)
" --module\t\t\tLink as a module\n"
" --module-id id\t\tSpecify a module ID for the linker\n"
" --no-target-lib\t\tDon't link the target library\n"
" --no-utf8\t\t\tDisable use of UTF-8 in diagnostics\n"
" --o65-model model\t\tOverride the o65 model\n"
" --obj file\t\t\tLink this object file\n"
" --obj-path path\t\tSpecify an object file search path\n"
@@ -1028,6 +1031,20 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg)
static void OptColor(const char* Opt, const char* Arg)
/* Handle the --color option */
{
ColorMode Mode = CP_Parse (Arg);
if (Mode == CM_INVALID) {
Error ("Invalid argument to %s: %s", Opt, Arg);
} else {
CmdAddArg2 (&CA65, "--color", Arg);
CmdAddArg2 (&LD65, "--color", Arg);
}
}
static void OptCPU (const char* Opt attribute ((unused)), const char* Arg)
/* Handle the --cpu option */
{
@@ -1236,6 +1253,16 @@ static void OptNoTargetLib (const char* Opt attribute ((unused)),
static void OptNoUtf8 (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Handle the --no-utf8 option */
{
CmdAddArg (&CA65, "--no-utf8");
CmdAddArg (&LD65, "--no-utf8");
}
static void OptO65Model (const char* Opt attribute ((unused)), const char* Arg)
/* Handle the --o65-model option */
{
@@ -1428,6 +1455,7 @@ int main (int argc, char* argv [])
{ "--code-label", 1, OptCodeLabel },
{ "--code-name", 1, OptCodeName },
{ "--codesize", 1, OptCodeSize },
{ "--color", 1, OptColor },
{ "--config", 1, OptConfig },
{ "--cpu", 1, OptCPU },
{ "--create-dep", 1, OptCreateDep },
@@ -1450,6 +1478,7 @@ int main (int argc, char* argv [])
{ "--module", 0, OptModule },
{ "--module-id", 1, OptModuleId },
{ "--no-target-lib", 0, OptNoTargetLib },
{ "--no-utf8", 0, OptNoUtf8 },
{ "--o65-model", 1, OptO65Model },
{ "--obj", 1, OptObj },
{ "--obj-path", 1, OptObjPath },