]> git.sur5r.net Git - cc65/blobdiff - src/cc65/main.c
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / cc65 / main.c
index 4165bc8575e6d93a5b55d55c7a3f8048e6bf2c50..546c7f27e1339df98e4fa2852c823d024120f471 100644 (file)
@@ -1,12 +1,12 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                                 main.c                                   */
+/*                                  main.c                                   */
 /*                                                                           */
-/*                            cc65 main program                             */
+/*                             cc65 main program                             */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2011, Ullrich von Bassewitz                                      */
+/* (C) 2000-2013, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
 #include "scanner.h"
 #include "segments.h"
 #include "standard.h"
-#include "svnversion.h"
 
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -119,7 +118,6 @@ static void Usage (void)
             "  --dep-target target\t\tUse this dependency target\n"
             "  --disable-opt name\t\tDisable an optimization step\n"
             "  --enable-opt name\t\tEnable an optimization step\n"
-            "  --forget-inc-paths\t\tForget include search paths\n"
             "  --help\t\t\tHelp (this text)\n"
             "  --include-dir dir\t\tSet an include directory search path\n"
             "  --list-opt-steps\t\tList all optimizer steps and exit\n"
@@ -155,75 +153,86 @@ static void SetSys (const char* Sys)
 {
     switch (Target = FindTarget (Sys)) {
 
-       case TGT_NONE:
-           break;
+        case TGT_NONE:
+            break;
 
         case TGT_MODULE:
             AbEnd ("Cannot use `module' as a target for the compiler");
             break;
 
-       case TGT_ATARI:
-           DefineNumericMacro ("__ATARI__", 1);
-           break;
+        case TGT_ATARI5200:
+            DefineNumericMacro ("__ATARI5200__", 1);
+            break;
 
-       case TGT_C16:
-           cbmsys ("__C16__");
-           break;
+        case TGT_ATARI:
+            DefineNumericMacro ("__ATARI__", 1);
+            break;
 
-       case TGT_C64:
-           cbmsys ("__C64__");
-           break;
+        case TGT_ATARIXL:
+            DefineNumericMacro ("__ATARI__", 1);
+            DefineNumericMacro ("__ATARIXL__", 1);
+            break;
 
-       case TGT_VIC20:
-           cbmsys ("__VIC20__");
-           break;
+        case TGT_C16:
+            cbmsys ("__C16__");
+            break;
 
-       case TGT_C128:
-           cbmsys ("__C128__");
-           break;
+        case TGT_C64:
+            cbmsys ("__C64__");
+            break;
 
-       case TGT_PLUS4:
-           cbmsys ("__PLUS4__");
-           break;
+        case TGT_VIC20:
+            cbmsys ("__VIC20__");
+            break;
 
-       case TGT_CBM510:
-           cbmsys ("__CBM510__");
-           break;
+        case TGT_C128:
+            cbmsys ("__C128__");
+            break;
 
-       case TGT_CBM610:
-           cbmsys ("__CBM610__");
-           break;
+        case TGT_PLUS4:
+            cbmsys ("__C16__");
+            DefineNumericMacro ("__PLUS4__", 1);
+            break;
 
-       case TGT_PET:
-           cbmsys ("__PET__");
-           break;
+        case TGT_CBM510:
+            cbmsys ("__CBM510__");
+            break;
 
-       case TGT_BBC:
-           DefineNumericMacro ("__BBC__", 1);
-           break;
+        case TGT_CBM610:
+            cbmsys ("__CBM610__");
+            break;
 
-       case TGT_APPLE2:
-           DefineNumericMacro ("__APPLE2__", 1);
-           break;
+        case TGT_PET:
+            cbmsys ("__PET__");
+            break;
+
+        case TGT_BBC:
+            DefineNumericMacro ("__BBC__", 1);
+            break;
+
+        case TGT_APPLE2:
+            DefineNumericMacro ("__APPLE2__", 1);
+            break;
 
-       case TGT_APPLE2ENH:
+        case TGT_APPLE2ENH:
+            DefineNumericMacro ("__APPLE2__", 1);
             DefineNumericMacro ("__APPLE2ENH__", 1);
-           break;
+            break;
 
-       case TGT_GEOS_CBM:
-           /* Do not handle as a CBM system */
-           DefineNumericMacro ("__GEOS__", 1);
-           DefineNumericMacro ("__GEOS_CBM__", 1);
-           break;
+        case TGT_GEOS_CBM:
+            /* Do not handle as a CBM system */
+            DefineNumericMacro ("__GEOS__", 1);
+            DefineNumericMacro ("__GEOS_CBM__", 1);
+            break;
 
-       case TGT_GEOS_APPLE:
-           DefineNumericMacro ("__GEOS__", 1);
-           DefineNumericMacro ("__GEOS_APPLE__", 1);
-           break;
+        case TGT_GEOS_APPLE:
+            DefineNumericMacro ("__GEOS__", 1);
+            DefineNumericMacro ("__GEOS_APPLE__", 1);
+            break;
 
-       case TGT_LUNIX:
-           DefineNumericMacro ("__LUNIX__", 1);
-           break;
+        case TGT_LUNIX:
+            DefineNumericMacro ("__LUNIX__", 1);
+            break;
 
         case TGT_ATMOS:
             DefineNumericMacro ("__ATMOS__", 1);
@@ -241,8 +250,16 @@ static void SetSys (const char* Sys)
             DefineNumericMacro ("__LYNX__", 1);
             break;
 
-       default:
-                   AbEnd ("Unknown target system type %d", Target);
+        case TGT_SIM6502:
+            DefineNumericMacro ("__SIM6502__", 1);
+            break;
+
+        case TGT_SIM65C02:
+            DefineNumericMacro ("__SIM65C02__", 1);
+            break;
+
+        default:
+            AbEnd ("Unknown target system type %d", Target);
     }
 
     /* Initialize the translation tables for the target system */
@@ -272,38 +289,38 @@ static void DefineSym (const char* Def)
 
     /* The symbol must start with a character or underline */
     if (Def [0] != '_' && !IsAlpha (Def [0])) {
-       InvDef (Def);
+        InvDef (Def);
     }
 
     /* Check the symbol name */
     while (IsAlNum (*P) || *P == '_') {
-       ++P;
+        ++P;
     }
 
     /* Do we have a value given? */
     if (*P != '=') {
-       if (*P != '\0') {
-           InvDef (Def);
-       }
-       /* No value given. Define the macro with the value 1 */
-       DefineNumericMacro (Def, 1);
+        if (*P != '\0') {
+            InvDef (Def);
+        }
+        /* No value given. Define the macro with the value 1 */
+        DefineNumericMacro (Def, 1);
     } else {
-       /* We have a value, P points to the '=' character. Since the argument
-        * is const, create a copy and replace the '=' in the copy by a zero
-        * terminator.
-                */
-       char* Q;
-       unsigned Len = strlen (Def)+1;
-       char* S = (char*) xmalloc (Len);
-       memcpy (S, Def, Len);
-       Q = S + (P - Def);
-       *Q++ = '\0';
-
-       /* Define this as a macro */
-       DefineTextMacro (S, Q);
-
-       /* Release the allocated memory */
-       xfree (S);
+        /* We have a value, P points to the '=' character. Since the argument
+         * is const, create a copy and replace the '=' in the copy by a zero
+         * terminator.
+         */
+        char* Q;
+        unsigned Len = strlen (Def)+1;
+        char* S = (char*) xmalloc (Len);
+        memcpy (S, Def, Len);
+        Q = S + (P - Def);
+        *Q++ = '\0';
+
+        /* Define this as a macro */
+        DefineTextMacro (S, Q);
+
+        /* Release the allocated memory */
+        xfree (S);
     }
 }
 
@@ -314,14 +331,14 @@ static void CheckSegName (const char* Seg)
 {
     /* Print an error and abort if the name is not ok */
     if (!ValidSegName (Seg)) {
-       AbEnd ("Segment name `%s' is invalid", Seg);
+        AbEnd ("Segment name `%s' is invalid", Seg);
     }
 }
 
 
 
 static void OptAddSource (const char* Opt attribute ((unused)),
-                         const char* Arg attribute ((unused)))
+                          const char* Arg attribute ((unused)))
 /* Add source lines as comments in generated assembler file */
 {
     AddSource = 1;
@@ -342,7 +359,7 @@ static void OptBssName (const char* Opt attribute ((unused)), const char* Arg)
 
 
 static void OptCheckStack (const char* Opt attribute ((unused)),
-                          const char* Arg attribute ((unused)))
+                           const char* Arg attribute ((unused)))
 /* Handle the --check-stack option */
 {
     IS_Set (&CheckStack, 1);
@@ -371,7 +388,7 @@ static void OptCodeSize (const char* Opt, const char* Arg)
     /* Numeric argument expected */
     if (sscanf (Arg, "%u%c", &Factor, &BoundsCheck) != 1 ||
         Factor < 10 || Factor > 1000) {
-       AbEnd ("Argument for %s is invalid", Opt);
+        AbEnd ("Argument for %s is invalid", Opt);
     }
     IS_Set (&CodeSizeFactor, Factor);
 }
@@ -387,7 +404,7 @@ static void OptCreateDep (const char* Opt, const char* Arg)
 
 
 static void OptCreateFullDep (const char* Opt attribute ((unused)),
-                             const char* Arg)
+                              const char* Arg)
 /* Handle the --create-full-dep option */
 {
     FileNameOption (Opt, Arg, &FullDepName);
@@ -402,7 +419,7 @@ static void OptCPU (const char* Opt, const char* Arg)
     CPU = FindCPU (Arg);
     if (CPU != CPU_6502 && CPU != CPU_6502X && CPU != CPU_65SC02 &&
         CPU != CPU_65C02 && CPU != CPU_65816 && CPU != CPU_HUC6280) {
-               AbEnd ("Invalid argument for %s: `%s'", Opt, Arg);
+        AbEnd ("Invalid argument for %s: `%s'", Opt, Arg);
     }
 }
 
@@ -421,7 +438,7 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg)
 
 
 static void OptDebug (const char* Opt attribute ((unused)),
-                     const char* Arg attribute ((unused)))
+                      const char* Arg attribute ((unused)))
 /* Compiler debug mode */
 {
     ++Debug;
@@ -430,7 +447,7 @@ static void OptDebug (const char* Opt attribute ((unused)),
 
 
 static void OptDebugInfo (const char* Opt attribute ((unused)),
-                         const char* Arg attribute ((unused)))
+                          const char* Arg attribute ((unused)))
 /* Add debug info to the object file */
 {
     DebugInfo = 1;
@@ -447,7 +464,7 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg)
     /* Open the file */
     FILE* F = fopen (Arg, "r");
     if (F == 0) {
-               AbEnd ("Cannot open `%s': %s", Arg, strerror (errno));
+        AbEnd ("Cannot open `%s': %s", Arg, strerror (errno));
     }
 
     /* Read line by line, ignore empty lines and switch optimization
@@ -455,45 +472,45 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg)
      */
     while (fgets (Buf, sizeof (Buf), F) != 0) {
 
-       /* Remove trailing control chars. This will also remove the
-        * trailing newline.
-        */
-       unsigned Len = strlen (Buf);
-       while (Len > 0 && IsControl (Buf[Len-1])) {
-           --Len;
-       }
-       Buf[Len] = '\0';
-
-       /* Get a pointer to the buffer and remove leading white space */
-       Line = Buf;
-       while (IsBlank (*Line)) {
-           ++Line;
-       }
-
-       /* Check the first character and enable/disable the step or
-        * ignore the line
-        */
-       switch (*Line) {
-
-           case '\0':
-           case '#':
-           case ';':
-               /* Empty or comment line */
-               continue;
-
-           case '-':
-               DisableOpt (Line+1);
-               break;
-
-           case '+':
-               ++Line;
-               /* FALLTHROUGH */
-
-           default:
-               EnableOpt (Line);
-               break;
-
-       }
+        /* Remove trailing control chars. This will also remove the
+         * trailing newline.
+         */
+        unsigned Len = strlen (Buf);
+        while (Len > 0 && IsControl (Buf[Len-1])) {
+            --Len;
+        }
+        Buf[Len] = '\0';
+
+        /* Get a pointer to the buffer and remove leading white space */
+        Line = Buf;
+        while (IsBlank (*Line)) {
+            ++Line;
+        }
+
+        /* Check the first character and enable/disable the step or
+         * ignore the line
+         */
+        switch (*Line) {
+
+            case '\0':
+            case '#':
+            case ';':
+                /* Empty or comment line */
+                continue;
+
+            case '-':
+                DisableOpt (Line+1);
+                break;
+
+            case '+':
+                ++Line;
+                /* FALLTHROUGH */
+
+            default:
+                EnableOpt (Line);
+                break;
+
+        }
 
     }
 
@@ -505,6 +522,15 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg)
 
 
 
+static void OptDebugOptOutput (const char* Opt attribute ((unused)), 
+                               const char* Arg attribute ((unused)))
+/* Output optimization steps */
+{
+    DebugOptOutput = 1;
+}
+
+
+
 static void OptDepTarget (const char* Opt attribute ((unused)), const char* Arg)
 /* Handle the --dep-target option */
 {
@@ -529,17 +555,8 @@ static void OptEnableOpt (const char* Opt attribute ((unused)), const char* Arg)
 
 
 
-static void OptForgetIncPaths (const char* Opt attribute ((unused)),
-                               const char* Arg attribute ((unused)))
-/* Forget all currently defined include paths */
-{
-    ForgetAllIncludePaths ();
-}
-
-
-
 static void OptHelp (const char* Opt attribute ((unused)),
-                    const char* Arg attribute ((unused)))
+                     const char* Arg attribute ((unused)))
 /* Print usage information and exit */
 {
     Usage ();
@@ -558,7 +575,7 @@ static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg
 
 
 static void OptListOptSteps (const char* Opt attribute ((unused)),
-                            const char* Arg attribute ((unused)))
+                             const char* Arg attribute ((unused)))
 /* List all optimizer steps */
 {
     /* List the optimizer steps */
@@ -571,7 +588,7 @@ static void OptListOptSteps (const char* Opt attribute ((unused)),
 
 
 static void OptListWarnings (const char* Opt attribute ((unused)),
-                            const char* Arg attribute ((unused)))
+                             const char* Arg attribute ((unused)))
 /* List all warning types */
 {
     /* List the warnings */
@@ -584,7 +601,7 @@ static void OptListWarnings (const char* Opt attribute ((unused)),
 
 
 static void OptLocalStrings (const char* Opt attribute ((unused)),
-                            const char* Arg attribute ((unused)))
+                             const char* Arg attribute ((unused)))
 /* Emit string literals immediately */
 {
     IS_Set (&LocalStrings, 1);
@@ -621,7 +638,7 @@ static void OptRegisterSpace (const char* Opt, const char* Arg)
 {
     /* Numeric argument expected */
     if (sscanf (Arg, "%u", &RegisterSpace) != 1 || RegisterSpace > 256) {
-               AbEnd ("Argument for option %s is invalid", Opt);
+        AbEnd ("Argument for option %s is invalid", Opt);
     }
 }
 
@@ -649,7 +666,7 @@ static void OptRodataName (const char* Opt attribute ((unused)), const char* Arg
 
 
 static void OptSignedChars (const char* Opt attribute ((unused)),
-                           const char* Arg attribute ((unused)))
+                            const char* Arg attribute ((unused)))
 /* Make default characters signed */
 {
     IS_Set (&SignedChars, 1);
@@ -663,7 +680,7 @@ static void OptStandard (const char* Opt, const char* Arg)
     /* Find the standard from the given name */
     standard_t Std = FindStandard (Arg);
     if (Std == STD_UNKNOWN) {
-               AbEnd ("Invalid argument for %s: `%s'", Opt, Arg);
+        AbEnd ("Invalid argument for %s: `%s'", Opt, Arg);
     } else if (IS_Get (&Standard) != STD_UNKNOWN) {
         AbEnd ("Option %s given more than once", Opt);
     } else {
@@ -674,7 +691,7 @@ static void OptStandard (const char* Opt, const char* Arg)
 
 
 static void OptStaticLocals (const char* Opt attribute ((unused)),
-                            const char* Arg attribute ((unused)))
+                             const char* Arg attribute ((unused)))
 /* Place local variables in static storage */
 {
     IS_Set (&StaticLocals, 1);
@@ -691,7 +708,7 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg)
 
 
 static void OptVerbose (const char* Opt attribute ((unused)),
-                       const char* Arg attribute ((unused)))
+                        const char* Arg attribute ((unused)))
 /* Increase verbosity */
 {
     ++Verbosity;
@@ -700,12 +717,10 @@ static void OptVerbose (const char* Opt attribute ((unused)),
 
 
 static void OptVersion (const char* Opt attribute ((unused)),
-                       const char* Arg attribute ((unused)))
+                        const char* Arg attribute ((unused)))
 /* Print the compiler version */
 {
-    fprintf (stderr,
-                    "cc65 V%s\nSVN version: %s\n",
-                    GetVersionAsString (), SVNVersion);
+    fprintf (stderr, "cc65 V%s\n", GetVersionAsString ());
     exit (EXIT_SUCCESS);
 }
 
@@ -758,7 +773,7 @@ static void OptWarning (const char* Opt attribute ((unused)), const char* Arg)
 
 
 static void OptWritableStrings (const char* Opt attribute ((unused)),
-                               const char* Arg attribute ((unused)))
+                                const char* Arg attribute ((unused)))
 /* Make string literals writable */
 {
     IS_Set (&WritableStrings, 1);
@@ -770,38 +785,38 @@ int main (int argc, char* argv[])
 {
     /* Program long options */
     static const LongOpt OptTab[] = {
-       { "--add-source",       0,      OptAddSource            },
-       { "--bss-name",         1,      OptBssName              },
-               { "--check-stack",      0,      OptCheckStack           },
-       { "--code-name",        1,      OptCodeName             },
-       { "--codesize",         1,      OptCodeSize             },
-        { "--cpu",                     1,      OptCPU                  },
-       { "--create-dep",       1,      OptCreateDep            },
+        { "--add-source",       0,      OptAddSource            },
+        { "--bss-name",         1,      OptBssName              },
+        { "--check-stack",      0,      OptCheckStack           },
+        { "--code-name",        1,      OptCodeName             },
+        { "--codesize",         1,      OptCodeSize             },
+        { "--cpu",              1,      OptCPU                  },
+        { "--create-dep",       1,      OptCreateDep            },
         { "--create-full-dep",  1,      OptCreateFullDep        },
-       { "--data-name",        1,      OptDataName             },
-               { "--debug",            0,      OptDebug                },
-       { "--debug-info",       0,      OptDebugInfo            },
+        { "--data-name",        1,      OptDataName             },
+        { "--debug",            0,      OptDebug                },
+        { "--debug-info",       0,      OptDebugInfo            },
         { "--debug-opt",        1,      OptDebugOpt             },
+        { "--debug-opt-output", 0,      OptDebugOptOutput       },
         { "--dep-target",       1,      OptDepTarget            },
-       { "--disable-opt",      1,      OptDisableOpt           },
-       { "--enable-opt",       1,      OptEnableOpt            },
-               { "--forget-inc-paths", 0,      OptForgetIncPaths       },
-       { "--help",             0,      OptHelp                 },
-       { "--include-dir",      1,      OptIncludeDir           },
-       { "--list-opt-steps",   0,      OptListOptSteps         },
-               { "--list-warnings",    0,      OptListWarnings         },
+        { "--disable-opt",      1,      OptDisableOpt           },
+        { "--enable-opt",       1,      OptEnableOpt            },
+        { "--help",             0,      OptHelp                 },
+        { "--include-dir",      1,      OptIncludeDir           },
+        { "--list-opt-steps",   0,      OptListOptSteps         },
+        { "--list-warnings",    0,      OptListWarnings         },
         { "--local-strings",    0,      OptLocalStrings         },
         { "--memory-model",     1,      OptMemoryModel          },
         { "--register-space",   1,      OptRegisterSpace        },
         { "--register-vars",    0,      OptRegisterVars         },
-       { "--rodata-name",      1,      OptRodataName           },
-       { "--signed-chars",     0,      OptSignedChars          },
+        { "--rodata-name",      1,      OptRodataName           },
+        { "--signed-chars",     0,      OptSignedChars          },
         { "--standard",         1,      OptStandard             },
-               { "--static-locals",    0,      OptStaticLocals         },
-       { "--target",           1,      OptTarget               },
-       { "--verbose",          0,      OptVerbose              },
-       { "--version",          0,      OptVersion              },
-               { "--writable-strings", 0,      OptWritableStrings      },
+        { "--static-locals",    0,      OptStaticLocals         },
+        { "--target",           1,      OptTarget               },
+        { "--verbose",          0,      OptVerbose              },
+        { "--version",          0,      OptVersion              },
+        { "--writable-strings", 0,      OptWritableStrings      },
     };
 
     unsigned I;
@@ -822,134 +837,137 @@ int main (int argc, char* argv[])
     I = 1;
     while (I < ArgCount) {
 
-       const char* P;
+        const char* P;
 
-               /* Get the argument */
-               const char* Arg = ArgVec[I];
+        /* Get the argument */
+        const char* Arg = ArgVec[I];
 
-               /* Check for an option */
-               if (Arg[0] == '-') {
+        /* Check for an option */
+        if (Arg[0] == '-') {
 
-                   switch (Arg[1]) {
+            switch (Arg[1]) {
 
-               case '-':
-                   LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
-                   break;
+                case '-':
+                    LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
+                    break;
 
-               case 'd':
-                   OptDebug (Arg, 0);
-                   break;
+                case 'd':
+                    OptDebug (Arg, 0);
+                    break;
 
-               case 'h':
-               case '?':
-                   OptHelp (Arg, 0);
-                   break;
+                case 'h':
+                case '?':
+                    OptHelp (Arg, 0);
+                    break;
 
-               case 'g':
-                   OptDebugInfo (Arg, 0);
-                   break;
+                case 'g':
+                    OptDebugInfo (Arg, 0);
+                    break;
 
-               case 'j':
-                   OptSignedChars (Arg, 0);
-                   break;
+                case 'j':
+                    OptSignedChars (Arg, 0);
+                    break;
 
-               case 'o':
-                   SetOutputName (GetArg (&I, 2));
-                   break;
+                case 'o':
+                    SetOutputName (GetArg (&I, 2));
+                    break;
 
                 case 'r':
                     OptRegisterVars (Arg, 0);
                     break;
 
-               case 't':
-                   OptTarget (Arg, GetArg (&I, 2));
-                   break;
-
-               case 'u':
-                   OptCreateDep (Arg, 0);
-                   break;
-
-               case 'v':
-                   OptVerbose (Arg, 0);
-                   break;
-
-               case 'C':
-                           P = Arg + 2;
-                   while (*P) {
-                       switch (*P++) {
-                           case 'l':
-                               OptStaticLocals (Arg, 0);
-                               break;
-                           default:
-                               UnknownOption (Arg);
-                               break;
-                       }
-                   }
-                   break;
-
-               case 'D':
-                   DefineSym (GetArg (&I, 2));
-                   break;
+                case 't':
+                    OptTarget (Arg, GetArg (&I, 2));
+                    break;
+
+                case 'u':
+                    OptCreateDep (Arg, 0);
+                    break;
+
+                case 'v':
+                    OptVerbose (Arg, 0);
+                    break;
+
+                case 'C':
+                    P = Arg + 2;
+                    while (*P) {
+                        switch (*P++) {
+                            case 'l':
+                                OptStaticLocals (Arg, 0);
+                                break;
+                            default:
+                                UnknownOption (Arg);
+                                break;
+                        }
+                    }
+                    break;
+
+                case 'D':
+                    DefineSym (GetArg (&I, 2));
+                    break;
 
                 case 'E':
                     PreprocessOnly = 1;
                     break;
 
-                       case 'I':
-                   OptIncludeDir (Arg, GetArg (&I, 2));
-                   break;
-
-               case 'O':
-                   IS_Set (&Optimize, 1);
-                   P = Arg + 2;
-                   while (*P) {
-                       switch (*P++) {
-                           case 'i':
-                               IS_Set (&CodeSizeFactor, 200);
-                               break;
-                           case 'r':
-                               IS_Set (&EnableRegVars, 1);
-                               break;
-                           case 's':
-                               IS_Set (&InlineStdFuncs, 1);
-                               break;
-                       }
-                   }
-                   break;
-
-               case 'T':
-                           OptAddSource (Arg, 0);
-                           break;
-
-                       case 'V':
-                           OptVersion (Arg, 0);
-                           break;
-
-                       case 'W':
+                case 'I':
+                    OptIncludeDir (Arg, GetArg (&I, 2));
+                    break;
+
+                case 'O':
+                    IS_Set (&Optimize, 1);
+                    P = Arg + 2;
+                    while (*P) {
+                        switch (*P++) {
+                            case 'i':
+                                IS_Set (&CodeSizeFactor, 200);
+                                break;
+                            case 'r':
+                                IS_Set (&EnableRegVars, 1);
+                                break;
+                            case 's':
+                                IS_Set (&InlineStdFuncs, 1);
+                                break;
+                        }
+                    }
+                    break;
+
+                case 'T':
+                    OptAddSource (Arg, 0);
+                    break;
+
+                case 'V':
+                    OptVersion (Arg, 0);
+                    break;
+
+                case 'W':
                     OptWarning (Arg, GetArg (&I, 2));
-                           break;
-
-                       default:
-                           UnknownOption (Arg);
-                           break;
-                   }
-               } else {
-                   if (InputFile) {
-                       fprintf (stderr, "additional file specs ignored\n");
-                   } else {
-                       InputFile = Arg;
-           }
-       }
-
-       /* Next argument */
-       ++I;
+                    break;
+
+                default:
+                    UnknownOption (Arg);
+                    break;
+            }
+        } else {
+            if (InputFile) {
+                fprintf (stderr, "additional file specs ignored\n");
+            } else {
+                InputFile = Arg;
+            }
+        }
+
+        /* Next argument */
+        ++I;
     }
 
     /* Did we have a file spec on the command line? */
     if (InputFile == 0) {
-       AbEnd ("No input files");
+        AbEnd ("No input files");
     }
 
+    /* Add the default include search paths. */
+    FinishIncludePaths ();
+
     /* Create the output file name if it was not explicitly given */
     MakeDefaultOutputName (InputFile);
 
@@ -981,23 +999,20 @@ int main (int argc, char* argv[])
         /* Emit literals, externals, do cleanup and optimizations */
         FinishCompile ();
 
-       /* Open the file */
+        /* Open the file */
         OpenOutputFile ();
 
-       /* Write the output to the file */
-               WriteAsmOutput ();
-               Print (stdout, 1, "Wrote output to `%s'\n", OutputFilename);
+        /* Write the output to the file */
+        WriteAsmOutput ();
+        Print (stdout, 1, "Wrote output to `%s'\n", OutputFilename);
 
-       /* Close the file, check for errors */
+        /* Close the file, check for errors */
         CloseOutputFile ();
 
-       /* Create dependencies if requested */
+        /* Create dependencies if requested */
         CreateDependencies ();
     }
 
     /* Return an apropriate exit code */
     return (ErrorCount > 0)? EXIT_FAILURE : EXIT_SUCCESS;
 }
-
-
-