summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-11-30 00:53:41 +0100
committerAraq <rumpf_a@web.de>2011-11-30 00:53:41 +0100
commitfc9fdc2b9d08e402b8504be422d403037e4ed85b (patch)
treefc5f69107279774521e727362d58dc45640468e0 /compiler
parent59543ef0a3e6b3da46bc1fa42053d78db8f73779 (diff)
downloadNim-fc9fdc2b9d08e402b8504be422d403037e4ed85b.tar.gz
cleaned up configuration file handling and documented the new behaviour
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/c2nim/nimrod.cfg (renamed from compiler/c2nim/c2nim.cfg)0
-rwxr-xr-xcompiler/cgen.nim2
-rwxr-xr-xcompiler/commands.nim32
-rwxr-xr-xcompiler/docgen.nim10
-rwxr-xr-xcompiler/extccomp.nim104
-rwxr-xr-xcompiler/main.nim20
-rwxr-xr-xcompiler/msgs.nim10
-rwxr-xr-xcompiler/nimconf.nim29
-rwxr-xr-xcompiler/nimrod.nim26
-rwxr-xr-xcompiler/options.nim19
-rwxr-xr-xcompiler/pas2nim/nimrod.cfg (renamed from compiler/pas2nim/pas2nim.cfg)0
-rwxr-xr-xcompiler/rodread.nim2
-rwxr-xr-xcompiler/rodwrite.nim2
13 files changed, 130 insertions, 126 deletions
diff --git a/compiler/c2nim/c2nim.cfg b/compiler/c2nim/nimrod.cfg
index cfeda63ed..cfeda63ed 100755
--- a/compiler/c2nim/c2nim.cfg
+++ b/compiler/c2nim/nimrod.cfg
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 5c730af80..2018d7e6d 100755
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -862,7 +862,7 @@ proc newModule(module: PSym, filename: string): BModule =
 proc registerTypeInfoModule() = 
   const moduleName = "nim__dat"
   var s = NewSym(skModule, getIdent(moduleName), nil)
-  gNimDat = rawNewModule(s, (options.projectPath / moduleName) & ".nim")
+  gNimDat = rawNewModule(s, (options.gProjectPath / moduleName) & ".nim")
   gNimDat.PreventStackTrace = true
   addPendingModule(gNimDat)
   appff(mainModProcs, "N_NOINLINE(void, $1)(void);$n", 
diff --git a/compiler/commands.nim b/compiler/commands.nim
index c6e00265f..bce24c5da 100755
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -37,37 +37,28 @@ proc getCommandLineDesc(): string =
   result = (HelpMessage % [VersionAsString, platform.os[platform.hostOS].name, 
                            cpu[platform.hostCPU].name]) & Usage
 
-var 
-  helpWritten: bool           # BUGFIX 19
-  versionWritten: bool
-  advHelpWritten: bool
-
 proc HelpOnError(pass: TCmdLinePass) = 
-  if (pass == passCmd1) and not helpWritten: 
-    # BUGFIX 19
+  if pass == passCmd1:
     MsgWriteln(getCommandLineDesc())
-    helpWritten = true
     quit(0)
 
 proc writeAdvancedUsage(pass: TCmdLinePass) = 
-  if (pass == passCmd1) and not advHelpWritten: 
-    # BUGFIX 19
+  if pass == passCmd1:
     MsgWriteln(`%`(HelpMessage, [VersionAsString, 
                                  platform.os[platform.hostOS].name, 
                                  cpu[platform.hostCPU].name]) & AdvancedUsage)
-    advHelpWritten = true
-    helpWritten = true
     quit(0)
 
 proc writeVersionInfo(pass: TCmdLinePass) = 
-  if (pass == passCmd1) and not versionWritten: 
-    versionWritten = true
-    helpWritten = true
+  if pass == passCmd1:
     MsgWriteln(`%`(HelpMessage, [VersionAsString, 
                                  platform.os[platform.hostOS].name, 
                                  cpu[platform.hostCPU].name]))
     quit(0)
 
+var
+  helpWritten: bool
+
 proc writeCommandLineUsage() = 
   if not helpWritten: 
     MsgWriteln(getCommandLineDesc())
@@ -197,8 +188,8 @@ proc testCompileOption*(switch: string, info: TLineInfo): bool =
 proc processPath(path: string): string = 
   result = UnixToNativePath(path % ["nimrod", getPrefixDir(), "lib", libpath,
     "home", removeTrailingDirSep(os.getHomeDir()),
-    "projectname", options.projectName,
-    "projectpath", options.projectPath])
+    "projectname", options.gProjectName,
+    "projectpath", options.gProjectPath])
 
 proc addPath(path: string, info: TLineInfo) = 
   if not contains(options.searchPaths, path): 
@@ -246,8 +237,8 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
     options.outFile = arg
   of "mainmodule", "m":
     expectArg(switch, arg, pass, info)
-    projectName = arg
-    projectFullPath = projectPath/projectName
+    gProjectName = arg
+    gProjectFull = gProjectPath / gProjectName
   of "define", "d": 
     expectArg(switch, arg, pass, info)
     DefineSymbol(arg)
@@ -433,6 +424,9 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
   of "skipusercfg":
     expectNoArg(switch, arg, pass, info)
     incl(gGlobalOptions, optSkipUserConfigFile)
+  of "skipparentcfg":
+    expectNoArg(switch, arg, pass, info)
+    incl(gGlobalOptions, optSkipParentConfigFiles)
   of "genscript": 
     expectNoArg(switch, arg, pass, info)
     incl(gGlobalOptions, optGenScript)
diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index 5e1e4b59c..36eff2576 100755
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -865,13 +865,13 @@ proc writeOutput(d: PDoc, filename, outExt: string) =
     writeRope(content, getOutFile(filename, outExt))
 
 proc CommandDoc =
-  var ast = parseFile(addFileExt(projectFullPath, nimExt))
+  var ast = parseFile(addFileExt(gProjectFull, nimExt))
   if ast == nil: return 
-  var d = newDocumentor(projectFullPath)
+  var d = newDocumentor(gProjectFull)
   initIndexFile(d)
   d.hasToc = true
   generateDoc(d, ast)
-  writeOutput(d, projectFullPath, HtmlExt)
+  writeOutput(d, gProjectFull, HtmlExt)
   generateIndex(d)
 
 proc CommandRstAux(filename, outExt: string) = 
@@ -884,9 +884,9 @@ proc CommandRstAux(filename, outExt: string) =
   generateIndex(d)
 
 proc CommandRst2Html =
-  CommandRstAux(projectFullPath, HtmlExt)
+  CommandRstAux(gProjectFull, HtmlExt)
 
 proc CommandRst2TeX =
   splitter = "\\-"
-  CommandRstAux(projectFullPath, TexExt)
+  CommandRstAux(gProjectFull, TexExt)
 
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 2d748c451..facb22432 100755
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -305,16 +305,14 @@ var
   cExt* = "c" # extension of generated C/C++ files
               # (can be changed to .cpp later)
   
-  cIncludes*: seq[string] = @[] # list of directories to search for included files
-  cLibs*: seq[string] = @[] # list of directories to search for lib files
-  cLinkedLibs*: seq[string] = @[] # list of libraries to link
+  cIncludes*: seq[string] = @[]   # directories to search for included files
+  cLibs*: seq[string] = @[]       # directories to search for lib files
+  cLinkedLibs*: seq[string] = @[] # libraries to link
 
 # implementation
 
-when defined(windows):
-  var libNameTmpl = "$1.lib"
-else:
-  var libNameTmpl = "lib$1.a"
+proc libNameTmpl(): string {.inline.} =
+  result = if targetOS == osWindows: "$1.lib" else: "lib$1.a"
 
 var 
   toLink, toCompile, externalToCompile: TLinkedList
@@ -431,43 +429,41 @@ const
 var fileCounter: int
 
 proc add(s: var string, many: openarray[string]) =
-  # XXX: is there something like C++'s reserve?
-  # We can use it here to avoid multiple reallocations
-  for x in items(many): s.add x
+  s.add many.join
 
-proc getCompileCFileCmd*(cfilename: string, isExternal: bool = false): string = 
-  var 
-    cfile, objfile, options, includeCmd, compilePattern, key, trunk, exe: string
-  var c = ccompiler
-  options = compileOptions
-  trunk = splitFile(cfilename).name
+proc CFileSpecificOptions(cfilename: string): string =
+  result = compileOptions
+  var trunk = splitFile(cfilename).name
   if optCDebug in gGlobalOptions: 
-    key = trunk & ".debug"
-    if existsConfigVar(key): addOpt(options, getConfigVar(key))
-    else: addOpt(options, getDebug(c))
-  if (optOptimizeSpeed in gOptions): 
-    #if ((fileCounter >= specialFileA) and (fileCounter <= specialFileB)) then
-    key = trunk & ".speed"
-    if existsConfigVar(key): addOpt(options, getConfigVar(key))
-    else: addOpt(options, getOptSpeed(c))
-  elif optOptimizeSize in gOptions: 
-    key = trunk & ".size"
-    if existsConfigVar(key): addOpt(options, getConfigVar(key))
-    else: addOpt(options, getOptSize(c))
-  key = trunk & ".always"
-  if existsConfigVar(key): addOpt(options, getConfigVar(key))
-  exe = cc[c].compilerExe
-  key = cc[c].name & ".exe"
+    var key = trunk & ".debug"
+    if existsConfigVar(key): addOpt(result, getConfigVar(key))
+    else: addOpt(result, getDebug(ccompiler))
+  if optOptimizeSpeed in gOptions:
+    var key = trunk & ".speed"
+    if existsConfigVar(key): addOpt(result, getConfigVar(key))
+    else: addOpt(result, getOptSpeed(ccompiler))
+  elif optOptimizeSize in gOptions:
+    var key = trunk & ".size"
+    if existsConfigVar(key): addOpt(result, getConfigVar(key))
+    else: addOpt(result, getOptSize(ccompiler))
+  var key = trunk & ".always"
+  if existsConfigVar(key): addOpt(result, getConfigVar(key))
+
+proc getCompileCFileCmd*(cfilename: string, isExternal = false): string = 
+  var c = ccompiler
+  var options = CFileSpecificOptions(cfilename)
+  var exe = cc[c].compilerExe
+  var key = cc[c].name & ".exe"
   if existsConfigVar(key): exe = getConfigVar(key)
   if targetOS == osWindows: exe = addFileExt(exe, "exe")
   if optGenDynLib in gGlobalOptions and
       ospNeedsPIC in platform.OS[targetOS].props: 
     add(options, ' ' & cc[c].pic)
+  
+  var includeCmd, compilePattern: string
   if targetOS == platform.hostOS: 
     # compute include paths:
-    includeCmd = cc[c].includeCmd # this is more complex than needed, but
-                                  # a workaround of a FPC bug...
-    add(includeCmd, quoteIfContainsWhite(libpath))
+    includeCmd = cc[c].includeCmd & quoteIfContainsWhite(libpath)
 
     for includeDir in items(cIncludes):
       includeCmd.add cc[c].includeCmd, includeDir.quoteIfContainsWhite
@@ -476,15 +472,17 @@ proc getCompileCFileCmd*(cfilename: string, isExternal: bool = false): string =
   else: 
     includeCmd = ""
     compilePattern = cc[c].compilerExe
-  if targetOS == platform.hostOS: cfile = cfilename
-  else: cfile = extractFileName(cfilename)
-  if not isExternal or targetOS != platform.hostOS: objfile = toObjFile(cfile)
-  else: objfile = completeCFilePath(toObjFile(cfile))
+  
+  # XXX fix the grammar finally, we need multi-line if expressions:
+  var cfile = if targetOS == platform.hostOS: cfilename else: extractFileName(
+                                                                     cfilename)
+  var objfile = if not isExternal or targetOS != platform.hostOS: toObjFile(
+                      cfile) else: completeCFilePath(toObjFile(cfile))
   cfile = quoteIfContainsWhite(AddFileExt(cfile, cExt))
   objfile = quoteIfContainsWhite(objfile)
-  result = quoteIfContainsWhite(`%`(compilePattern, ["file", cfile, "objfile", 
-      objfile, "options", options, "include", includeCmd, "nimrod", 
-      getPrefixDir(), "lib", libpath]))
+  result = quoteIfContainsWhite(compilePattern % [
+    "file", cfile, "objfile", objfile, "options", options, 
+    "include", includeCmd, "nimrod", getPrefixDir(), "lib", libpath])
   add(result, ' ')
   addf(result, cc[c].compileTmpl, [
     "file", cfile, "objfile", objfile, 
@@ -498,9 +496,9 @@ proc CompileCFile(list: TLinkedList, script: var PRope, cmds: var TStringSeq,
   while it != nil: 
     inc(fileCounter)          # call the C compiler for the .c file:
     var compileCmd = getCompileCFileCmd(it.data, isExternal)
-    if not (optCompileOnly in gGlobalOptions): 
+    if optCompileOnly notin gGlobalOptions: 
       add(cmds, compileCmd)
-    if (optGenScript in gGlobalOptions): 
+    if optGenScript in gGlobalOptions: 
       app(script, compileCmd)
       app(script, tnl)
     it = PStrEntry(it.next)
@@ -522,7 +520,7 @@ proc CallCCompiler*(projectfile: string) =
     var res = 0
     if gNumberOfProcessors <= 1: 
       for i in countup(0, high(cmds)): res = max(execCmd(cmds[i]), res)
-    elif (optListCmd in gGlobalOptions) or (gVerbosity > 0): 
+    elif optListCmd in gGlobalOptions or gVerbosity > 0: 
       res = execProcesses(cmds, {poEchoCmd, poUseShell, poParentStreams}, 
                           gNumberOfProcessors)
     else: 
@@ -535,26 +533,25 @@ proc CallCCompiler*(projectfile: string) =
     var objfiles = ""
     while it != nil:
       add(objfiles, ' ')
-      if targetOS == platform.hostOS:
-        add(objfiles, quoteIfContainsWhite(addFileExt(it.data, cc[ccompiler].objExt)))
-      else:
-        add(objfiles, quoteIfContainsWhite(addFileExt(it.data, cc[ccompiler].objExt)))
+      add(objfiles, quoteIfContainsWhite(
+          addFileExt(it.data, cc[ccompiler].objExt)))
       it = PStrEntry(it.next)
 
     if optGenStaticLib in gGlobalOptions:
-      linkcmd = cc[c].buildLib % ["libfile", (libNameTmpl % projectName), "objfiles", objfiles]
+      linkcmd = cc[c].buildLib % ["libfile", (libNameTmpl() % gProjectName),
+                                  "objfiles", objfiles]
       if optCompileOnly notin gGlobalOptions: execExternalProgram(linkCmd)
     else:
       var linkerExe = getConfigVar(cc[c].name & ".linkerexe")
       if len(linkerExe) == 0: linkerExe = cc[c].linkerExe
       if targetOS == osWindows: linkerExe = addFileExt(linkerExe, "exe")
-      if (platform.hostOS != targetOS): linkCmd = quoteIfContainsWhite(linkerExe)
+      if platform.hostOS != targetOS: linkCmd = quoteIfContainsWhite(linkerExe)
       else: linkCmd = quoteIfContainsWhite(JoinPath(ccompilerpath, linkerExe))
       if optGenGuiApp in gGlobalOptions: buildGui = cc[c].buildGui
       else: buildGui = ""
       var exefile: string
       if optGenDynLib in gGlobalOptions:
-        exefile = `%`(platform.os[targetOS].dllFrmt, [splitFile(projectFile).name])
+        exefile = platform.os[targetOS].dllFrmt % [splitFile(projectFile).name]
         buildDll = cc[c].buildDll
       else:
         exefile = splitFile(projectFile).name & platform.os[targetOS].exeExt
@@ -596,4 +593,5 @@ proc writeMapping*(gSymbolMapping: PRope) =
   app(code, genMappingFiles(toCompile))
   app(code, genMappingFiles(externalToCompile))
   appf(code, "[Symbols]$n$1", [gSymbolMapping])
-  WriteRope(code, joinPath(projectPath, "mapping.txt"))
+  WriteRope(code, joinPath(gProjectPath, "mapping.txt"))
+  
diff --git a/compiler/main.nim b/compiler/main.nim
index 70e1bc06d..6e3fb7ff4 100755
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -81,7 +81,7 @@ proc CompileModule(filename: string, flags: TSymFlags): PSym =
     result.id = getID()
   processModule(result, f, nil, rd)
 
-proc CompileProject(projectFile = projectFullPath) =
+proc CompileProject(projectFile = gProjectFull) =
   discard CompileModule(options.libpath / "system", {sfSystemModule})
   discard CompileModule(projectFile, {sfMainModule})
 
@@ -95,9 +95,9 @@ proc CommandGenDepend =
   registerPass(genDependPass())
   registerPass(cleanupPass())
   compileProject()
-  generateDot(projectFullPath)
-  execExternalProgram("dot -Tpng -o" & changeFileExt(projectFullPath, "png") &
-      ' ' & changeFileExt(projectFullPath, "dot"))
+  generateDot(gProjectFull)
+  execExternalProgram("dot -Tpng -o" & changeFileExt(gProjectFull, "png") &
+      ' ' & changeFileExt(gProjectFull, "dot"))
 
 proc CommandCheck =
   msgs.gErrorMax = high(int)  # do not stop after first error
@@ -112,7 +112,7 @@ proc CommandCompileToC =
   #registerPass(cleanupPass())
   compileProject()
   if gCmd != cmdRun:
-    extccomp.CallCCompiler(changeFileExt(projectFullPath, ""))
+    extccomp.CallCCompiler(changeFileExt(gProjectFull, ""))
 
 when has_LLVM_Backend:
   proc CommandCompileToLLVM =
@@ -177,14 +177,14 @@ proc CommandSuggest =
   compileProject()
 
 proc wantMainModule =
-  if projectFullPath.len == 0:
+  if gProjectFull.len == 0:
     Fatal(newLineInfo("command line", 1, 1), errCommandExpectsFilename)
   
 proc MainCommand =
   appendStr(searchPaths, options.libpath)
-  if projectFullPath.len != 0:
-    # current path is dalways looked first for modules
-    prependStr(searchPaths, projectPath)
+  if gProjectFull.len != 0:
+    # current path is always looked first for modules
+    prependStr(searchPaths, gProjectPath)
   setID(100)
   passes.gIncludeFile = syntaxes.parseFile
   passes.gImportModule = importModule
@@ -259,7 +259,7 @@ proc MainCommand =
   of "parse": 
     gCmd = cmdParse
     wantMainModule()
-    discard parseFile(addFileExt(projectFullPath, nimExt))
+    discard parseFile(addFileExt(gProjectFull, nimExt))
   of "scan": 
     gCmd = cmdScan
     wantMainModule()
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 1b218ad7e..d3ab9a989 100755
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -96,7 +96,7 @@ type
     errUser,
     warnCannotOpenFile, 
     warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit, 
-    warnDeprecated, 
+    warnDeprecated, warnConfigDeprecated,
     warnSmallLshouldNotBeUsed, warnUnknownMagic, warnRedefinitionOfLabel, 
     warnUnknownSubstitutionX, warnLanguageXNotSupported, warnCommentXIgnored, 
     warnXisPassedToProcVar, warnDerefDeprecated, warnAnalysisLoophole,
@@ -328,6 +328,7 @@ const
     warnXIsNeverRead: "\'$1\' is never read [XIsNeverRead]", 
     warnXmightNotBeenInit: "\'$1\' might not have been initialized [XmightNotBeenInit]", 
     warnDeprecated: "\'$1\' is deprecated [Deprecated]", 
+    warnConfigDeprecated: "config file '$1' is deprecated [ConfigDeprecated]",
     warnSmallLshouldNotBeUsed: "\'l\' should not be used as an identifier; may look like \'1\' (one) [SmallLshouldNotBeUsed]", 
     warnUnknownMagic: "unknown magic \'$1\' might crash the compiler [UnknownMagic]", 
     warnRedefinitionOfLabel: "redefinition of label \'$1\' [RedefinitionOfLabel]", 
@@ -356,9 +357,10 @@ const
     hintUser: "$1 [User]"]
 
 const
-  WarningsToStr*: array[0..16, string] = ["CannotOpenFile", "OctalEscape", 
+  WarningsToStr*: array[0..17, string] = ["CannotOpenFile", "OctalEscape", 
     "XIsNeverRead", "XmightNotBeenInit",
-    "Deprecated", "SmallLshouldNotBeUsed", "UnknownMagic", 
+    "Deprecated", "ConfigDeprecated",
+    "SmallLshouldNotBeUsed", "UnknownMagic", 
     "RedefinitionOfLabel", "UnknownSubstitutionX", "LanguageXNotSupported", 
     "CommentXIgnored", "XisPassedToProcVar", "DerefDeprecated",
     "AnalysisLoophole", "DifferentHeaps", "WriteToForeignHeap", "User"]
@@ -443,7 +445,7 @@ proc includeFilename*(f: string): int =
 
   filenames.add((filename: f, fullpath: fullpath))
 
-proc newLineInfo*(filename: string, line, col: int): TLineInfo = 
+proc newLineInfo(filename: string, line, col: int): TLineInfo = 
   result.fileIndex = includeFilename(filename)
   result.line = int16(line)
   result.col = int16(col)
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
index fea22f86b..d33f1244d 100755
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -189,14 +189,14 @@ proc parseAssignment(L: var TLexer, tok: var TToken) =
       confTok(L, tok)
   processSwitch(s, val, passPP, info)
 
-proc readConfigFile(filename: string) = 
-  var 
+proc readConfigFile(filename: string) =
+  var
     L: TLexer
     tok: TToken
     stream: PLLStream
-  initToken(tok)
   stream = LLStreamOpen(filename, fmRead)
-  if stream != nil: 
+  if stream != nil:
+    initToken(tok)
     openLexer(L, filename, stream)
     tok.tokType = tkEof       # to avoid a pointless warning
     confTok(L, tok)           # read in the first token
@@ -214,7 +214,7 @@ proc getSystemConfigPath(filename: string): string =
   result = joinPath([getPrefixDir(), "config", filename])
   if not ExistsFile(result): result = "/etc/" & filename
 
-proc LoadConfigs*(cfg = "nimrod.cfg") =
+proc LoadConfigs*(cfg: string) =
   # set default value (can be overwritten):
   if libpath == "": 
     # choose default libpath:
@@ -224,12 +224,21 @@ proc LoadConfigs*(cfg = "nimrod.cfg") =
     else: libpath = joinPath(prefix, "lib")
 
   if optSkipConfigFile notin gGlobalOptions:
-    readConfigFile getSystemConfigPath(cfg)
+    readConfigFile(getSystemConfigPath(cfg))
 
   if optSkipUserConfigFile notin gGlobalOptions:
-    readConfigFile getUserConfigPath(cfg)
+    readConfigFile(getUserConfigPath(cfg))
 
-  if optSkipProjConfigFile notin gGlobalOptions and projectPath != "":
-    for dir in parentDirs(projectPath, fromRoot = true):
-      readConfigFile(dir/cfg)
+  var pd = if gProjectPath.len > 0: gProjectPath else: getCurrentDir()
+  if optSkipParentConfigFiles notin gGlobalOptions:
+    for dir in parentDirs(pd, fromRoot=true, inclusive=false):
+      readConfigFile(dir / cfg)
     
+  if optSkipProjConfigFile notin gGlobalOptions and gProjectName.len != 0:
+    readConfigFile(pd / cfg)
+    
+    var conffile = changeFileExt(gProjectFull, "cfg")
+    if conffile != pd / cfg and existsFile(conffile):
+      readConfigFile(conffile)
+      rawMessage(warnConfigDeprecated, conffile)
+      
diff --git a/compiler/nimrod.nim b/compiler/nimrod.nim
index becf2430f..97e017e4f 100755
--- a/compiler/nimrod.nim
+++ b/compiler/nimrod.nim
@@ -44,9 +44,9 @@ proc ProcessCmdLine(pass: TCmdLinePass) =
         else:
           options.commandArgs.add p.key
 
-          if options.projectName == "":
+          if options.gProjectName == "":
             # support UNIX style filenames anywhere for portable build scripts:
-            options.projectName = unixToNativePath(p.key)
+            options.gProjectName = unixToNativePath(p.key)
             arguments = cmdLineRest(p)
           
   if pass == passCmd2:
@@ -64,20 +64,20 @@ proc HandleCmdLine() =
   var start = epochTime()
   if paramCount() == 0: 
     writeCommandLineUsage()
-  else: 
+  else:
     # Process command line arguments:
     ProcessCmdLine(passCmd1)
-    if projectName != "":
+    if gProjectName != "":
       try:
-        projectFullPath = expandFilename(projectName)
+        gProjectFull = expandFilename(gProjectName)
       except EOS:
-        projectFullPath = projectName
-      var p = splitFile(projectFullPath)
-      projectPath = p.dir
-      projectName = p.name
+        gProjectFull = gProjectName
+      var p = splitFile(gProjectFull)
+      gProjectPath = p.dir
+      gProjectName = p.name
     else:
-      projectPath = getCurrentDir()
-    LoadConfigs() # load all config files
+      gProjectPath = getCurrentDir()      
+    LoadConfigs(DefaultConfig) # load all config files
     # now process command line arguments again, because some options in the
     # command line can overwite the config file's settings
     extccomp.initVars()
@@ -91,9 +91,9 @@ proc HandleCmdLine() =
       if gCmd notin {cmdInterpret, cmdRun}: 
         rawMessage(hintSuccessX, [$gLinesCompiled, 
                    formatFloat(epochTime() - start, ffDecimal, 3)])
-      if optRun in gGlobalOptions: 
+      if optRun in gGlobalOptions:
         var ex = quoteIfContainsWhite(
-            changeFileExt(projectFullPath, "").prependCurDir)
+            changeFileExt(gProjectFull, "").prependCurDir)
         execExternalProgram(ex & ' ' & arguments)
 
 #GC_disableMarkAndSweep()
diff --git a/compiler/options.nim b/compiler/options.nim
index 8820b1803..ea36e3c6a 100755
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -42,6 +42,7 @@ type                          # please make sure we have under 32 options
     optSkipConfigFile,        # skip the general config file
     optSkipProjConfigFile,    # skip the project's config file
     optSkipUserConfigFile,    # skip the users's config file
+    optSkipParentConfigFiles, # skip parent dir's config files
     optNoMain,                # do not generate a "main" proc
     optThreads,               # support for multi-threading
     optStdout,                # output to stdout
@@ -93,6 +94,7 @@ const
   HtmlExt* = "html"
   TexExt* = "tex"
   IniExt* = "ini"
+  DefaultConfig* = "nimrod.cfg"
   DocConfig* = "nimdoc.cfg"
   DocTexConfig* = "nimdoc.tex.cfg"
 
@@ -100,9 +102,9 @@ const
 var
   gConfigVars* = newStringTable(modeStyleInsensitive)
   libpath* = ""
-  projectName* = "" # holds a name like `nimrod'
-  projectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/
-  projectFullPath* = "" # projectPath/projectName
+  gProjectName* = "" # holds a name like 'nimrod'
+  gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/
+  gProjectFull* = "" # projectPath/projectName
   nimcacheDir* = ""
   command* = "" # the main command (e.g. cc, check, scan, etc)
   commandArgs*: seq[string] = @[] # any arguments after the main command
@@ -117,7 +119,7 @@ proc mainCommandArg*: string =
   if commandArgs.len > 0:
     result = commandArgs[0]
   else:
-    result = projectName
+    result = gProjectName
 
 proc existsConfigVar*(key: string): bool = 
   result = hasKey(gConfigVars, key)
@@ -136,7 +138,7 @@ proc getPrefixDir*(): string =
   ## gets the application directory
   result = SplitPath(getAppDir()).head
 
-proc shortenDir(dir: string): string = 
+proc shortenDir*(dir: string): string = 
   ## returns the interesting part of a dir
   var prefix = getPrefixDir() & dirSep
   if startsWith(dir, prefix): 
@@ -144,9 +146,8 @@ proc shortenDir(dir: string): string =
   prefix = getCurrentDir() & dirSep
   if startsWith(dir, prefix): 
     return substr(dir, len(prefix))
-  prefix = projectPath & dirSep #writeln(output, prefix);
-                                #writeln(output, dir);
-  if startsWith(dir, prefix): 
+  prefix = gProjectPath & dirSep
+  if startsWith(dir, prefix):
     return substr(dir, len(prefix))
   result = dir
 
@@ -157,7 +158,7 @@ proc removeTrailingDirSep*(path: string): string =
     result = path
   
 proc getGeneratedPath: string =
-  result = if nimcacheDir.len > 0: nimcacheDir else: projectPath.shortenDir /
+  result = if nimcacheDir.len > 0: nimcacheDir else: gProjectPath.shortenDir /
                                                          genSubDir
   
 proc toGeneratedFile*(path, ext: string): string = 
diff --git a/compiler/pas2nim/pas2nim.cfg b/compiler/pas2nim/nimrod.cfg
index cfeda63ed..cfeda63ed 100755
--- a/compiler/pas2nim/pas2nim.cfg
+++ b/compiler/pas2nim/nimrod.cfg
diff --git a/compiler/rodread.nim b/compiler/rodread.nim
index df5b4e87a..3f1be6666 100755
--- a/compiler/rodread.nim
+++ b/compiler/rodread.nim
@@ -836,7 +836,7 @@ proc handleSymbolFile(module: PSym, filename: string): PRodReader =
   if optSymbolFiles notin gGlobalOptions: 
     module.id = getID()
     return nil
-  idgen.loadMaxIds(options.projectPath / options.projectName)
+  idgen.loadMaxIds(options.gProjectPath / options.gProjectName)
 
   discard checkDep(filename)
   var idx = getModuleIdx(filename)
diff --git a/compiler/rodwrite.nim b/compiler/rodwrite.nim
index e08d78ae2..77e0ec844 100755
--- a/compiler/rodwrite.nim
+++ b/compiler/rodwrite.nim
@@ -576,7 +576,7 @@ proc myClose(c: PPassContext, n: PNode): PNode =
   result = process(c, n)
   var w = PRodWriter(c)
   writeRod(w)
-  idgen.saveMaxIds(options.projectPath / options.projectName)
+  idgen.saveMaxIds(options.gProjectPath / options.gProjectName)
 
 proc rodwritePass(): TPass = 
   initPass(result)