Implemented global cross-reference generation
[senf.git] / senfscons / Doxygen.py
index db9fc5c..705e22a 100644 (file)
@@ -40,7 +40,7 @@ def DoxyfileParse_(file, data):
       lex = shlex.shlex(instream=open(file), posix=True)
       lex.wordchars += "*+./-:@~"
       lex.whitespace = lex.whitespace.replace("\n", "")
-      lex.escape = ""
+      lex.escape = "\\"
 
       lineno = lex.lineno
       token = lex.get_token()
@@ -127,9 +127,9 @@ def DoxySourceScan(node, env, path):
          for root, dirs, files in entries:
             for f in files:
                filename = os.path.normpath(os.path.join(root, f))
-               if ( reduce(lambda x, y: x or fnmatch(filename, y),
+               if ( reduce(lambda x, y: x or fnmatch(f, y),
                            file_patterns, False) 
-                    and not reduce(lambda x, y: x or fnmatch(filename, y),
+                    and not reduce(lambda x, y: x or fnmatch(f, y),
                                    exclude_patterns, False) ):
                   sources.append(filename)
 
@@ -161,7 +161,13 @@ def DoxyEmitter(source, target, env):
    data = DoxyfileParse(source[0].abspath)
 
    targets = []
-   out_dir = data.get("OUTPUT_DIRECTORY", ".")
+   if data.has_key("OUTPUT_DIRECTORY"):
+      out_dir = data["OUTPUT_DIRECTORY"]
+      dir = env.Dir( os.path.join(source[0].dir.abspath, out_dir) )
+      dir.sources = source
+      targets.append(dir)
+   else:
+      out_dir = '.'
 
    # add our output locations
    for (k, v) in output_formats.iteritems():
@@ -169,13 +175,16 @@ def DoxyEmitter(source, target, env):
          # Grmpf ... need to use a File object here. The problem is, that
          # Dir.scan() is implemented to just return the directory entries
          # and does *not* invoke the source-file scanners .. ARGH !!
-         dir = env.Dir( os.path.join(str(source[0].dir), out_dir, data.get(k + "_OUTPUT", v[1])) )
-         node = env.File( os.path.join(str(dir), ".stamp" ) )
-         env.Clean(node, dir)
-         targets.append( node )
+         dir = env.Dir( os.path.join(source[0].dir.abspath, out_dir, data.get(k + "_OUTPUT", v[1])) )
+         # This is needed to silence the (wrong) 'Multiple ways to
+         # build the same target' message
+         dir.sources = source
+         node = env.File( os.path.join(dir.abspath, ".stamp" ) )
+         targets.append(node)
+         targets.append(dir)
 
    if data.has_key("GENERATE_TAGFILE"):
-      targets.append(env.File( os.path.join(str(source[0].dir), data["GENERATE_TAGFILE"]) ))
+      targets.append(env.File( os.path.join(source[0].dir.abspath, data["GENERATE_TAGFILE"]) ))
 
    # don't clobber targets
    for node in targets:
@@ -187,7 +196,7 @@ def doxyNodeHtmlDir(node):
    if not node.sources : return None
    data = DoxyfileParse(node.sources[0].abspath)
    if data.get("GENERATE_HTML",'YES').upper() != 'YES' : return None
-   return os.path.normpath(os.path.join( node.sources[0].abspath,
+   return os.path.normpath(os.path.join( node.sources[0].dir.abspath,
                                          data.get("OUTPUT_DIRECTORY","."),
                                          data.get("HTML_OUTPUT","html") ))