]> git.sur5r.net Git - cc65/blobdiff - src/cl65/main.c
Rather stay with OFF_YEAR as it is an "officially" name.
[cc65] / src / cl65 / main.c
index 735e9cc02ac359cc98801dd302c3b4f873c0db27..d20f1a2becb51f75038bec95a9da0f274571f565 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                          */
 /*                                                                          */
 /*                                                                          */
-/* (C) 1999-2011, Ullrich von Bassewitz                                      */
+/* (C) 1999-2012, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -306,7 +306,7 @@ static void CmdSetOutput (CmdDesc* Cmd, const char* File)
 static void CmdSetTarget (CmdDesc* Cmd, target_t Target)
 /* Set the output file in a command desc */
 {
-    CmdAddArg2 (Cmd, "-t", TargetNames[Target]);
+    CmdAddArg2 (Cmd, "-t", GetTargetName (Target));
 }
 
 
@@ -335,7 +335,7 @@ static void SetTargetFiles (void)
     if (Target != TGT_NONE) {
 
        /* Get a pointer to the system name and its length */
-       const char* TargetName = TargetNames [Target];
+       const char* TargetName = GetTargetName (Target);
        unsigned    TargetNameLen = strlen (TargetName);
 
        /* Set the library file */
@@ -594,6 +594,11 @@ static void CompileRes (const char* File)
     /* Remember the current assembler argument count */
     unsigned ArgCount = GRC.ArgCount;
 
+    /* Resource files need an geos-apple or geos-cbm target but this
+     * is checked within grc65.
+     */
+    CmdSetTarget (&GRC, Target);
+
     /* Add the file as argument for the resource compiler */
     CmdAddArg (&GRC, File);
 
@@ -692,6 +697,7 @@ static void Usage (void)
             "  -V\t\t\t\tPrint the version number\n"
             "  -W name[,...]\t\t\tSuppress compiler warnings\n"
             "  -Wa options\t\t\tPass options to the assembler\n"
+            "  -Wc options\t\t\tPass options to the compiler\n"
             "  -Wl options\t\t\tPass options to the linker\n"
             "\n"
             "Long options:\n"
@@ -702,6 +708,7 @@ static void Usage (void)
             "  --bin-include-dir dir\t\tSet an assembler binary include directory\n"
             "  --bss-label name\t\tDefine and export a BSS segment label\n"
             "  --bss-name seg\t\tSet the name of the BSS segment\n"
+            "  --cc-args options\t\tPass options to the compiler\n"
             "  --cfg-path path\t\tSpecify a config file search path\n"
             "  --check-stack\t\t\tGenerate stack overflow checks\n"
             "  --code-label name\t\tDefine and export a CODE segment label\n"
@@ -808,6 +815,14 @@ static void OptBssName (const char* Opt attribute ((unused)), const char* Arg)
 
 
 
+static void OptCCArgs (const char* Opt attribute ((unused)), const char* Arg)
+/* Pass arguments to the compiler */
+{
+    CmdAddArgList (&CC65, Arg);
+}
+
+
+
 static void OptCfgPath (const char* Opt attribute ((unused)), const char* Arg)
 /* Config file search path (linker) */
 {
@@ -1021,11 +1036,11 @@ static void OptListTargets (const char* Opt attribute ((unused)),
                            const char* Arg attribute ((unused)))
 /* List all targets */
 {
-    unsigned I;
+    target_t T;
 
     /* List the targets */
-    for (I = TGT_NONE; I < TGT_COUNT; ++I) {
-       printf ("%s\n", TargetNames[I]);
+    for (T = TGT_NONE; T < TGT_COUNT; ++T) {
+       printf ("%s\n", GetTargetName (T));
     }
 
     /* Terminate */
@@ -1224,6 +1239,7 @@ int main (int argc, char* argv [])
         { "--bin-include-dir",  1,      OptBinIncludeDir        },
                { "--bss-label",        1,      OptBssLabel             },
        { "--bss-name",         1,      OptBssName              },
+        { "--cc-args",          1,      OptCCArgs               },
                { "--cfg-path",         1,      OptCfgPath              },
                { "--check-stack",      0,      OptCheckStack           },
                { "--code-label",       1,      OptCodeLabel            },
@@ -1279,7 +1295,7 @@ int main (int argc, char* argv [])
     CmdInit (&CA65, "ca65");
     CmdInit (&CO65, "co65");
     CmdInit (&LD65, "ld65");
-    CmdInit (&GRC,  "grc");
+    CmdInit (&GRC,  "grc65");
 
     /* Our default target is the C64 instead of "none" */
     Target = TGT_C64;
@@ -1355,6 +1371,9 @@ int main (int argc, char* argv [])
                    if (Arg[2] == 'a' && Arg[3] == '\0') {
                        /* -Wa: Pass options to assembler */
                        OptAsmArgs (Arg, GetArg (&I, 3));
+                   } else if (Arg[2] == 'c' && Arg[3] == '\0') {
+                       /* -Wc: Pass options to compiler */
+                       OptCCArgs (Arg, GetArg (&I, 3));
                    } else if (Arg[2] == 'l' && Arg[3] == '\0') {
                        /* -Wl: Pass options to linker */
                        OptLdArgs (Arg, GetArg (&I, 3));