Packet/80221Bundle: Small MIHPacket fixes
[senf.git] / senfscons / Doxygen.py
index 0e8dd24..5e327fa 100644 (file)
@@ -18,8 +18,8 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 # The Modifications are Copyright (C) 2006,2007
-# Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-# Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+# Fraunhofer Institute for Open Communication Systems (FOKUS) 
+# Competence Center NETwork research (NET), St. Augustin, GERMANY 
 #     Stefan Bund <g0dil@berlios.de>
 
 ## \file
@@ -234,7 +234,7 @@ class DoxyfileParser:
       for d in [ self._dir ] + self._include_path:
          p = os.path.join(d,value[0])
          if os.path.exists(p):
-            self._items.setdefault('@INCLDUE',[]).append(p)
+            self._items.setdefault('@INCLUDE',[]).append(p)
             parser = DoxyfileParser(p, self._env, self._include_path, self._items)
             parser.parse()
             return
@@ -248,6 +248,10 @@ class DoxyfileParser:
       return self._items
 
 def DoxyfileParse(env,file):
+   # We don't parse source files which do not contain the word 'doxyfile'. SCons will
+   # pass other dependencies to DoxyfileParse which are not doxyfiles ... grmpf ...
+   if not 'doxyfile' in file.lower():
+      return {}
    ENV = {}
    ENV.update(env.get("ENV",{}))
    ENV['TOPDIR'] = env.Dir('#').abspath
@@ -260,7 +264,7 @@ def DoxyfileParse(env,file):
    data = parser.items()
    for k,v in data.items():
       if not v : del data[k]
-      elif k in ("INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS", "@INCLUDE", "TAGFILES") : continue
+      elif k in ("LAYOUT_FILE", "INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS", "@INCLUDE", "TAGFILES") : continue
       elif len(v)==1 : data[k] = v[0]
    return data
 
@@ -270,7 +274,7 @@ def DoxySourceScan(node, env, path):
    any files used to generate docs to the list of source files.
    """
    dep_add_keys = (
-      '@INCLUDE', 'HTML_HEADER', 'HTML_FOOTER', 'TAGFILES', 'INPUT_FILTER'
+      'LAYOUT_FILE', '@INCLUDE', 'HTML_HEADER', 'HTML_FOOTER', 'TAGFILES', 'INPUT_FILTER'
    )
 
    default_file_patterns = (
@@ -301,10 +305,8 @@ 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(f, y),
-                           file_patterns, False)
-                    and not reduce(lambda x, y: x or fnmatch(f, y),
-                                   exclude_patterns, False) ):
+               if (         reduce(lambda x, y: x or fnmatch(f, y), file_patterns,    False)
+                    and not reduce(lambda x, y: x or fnmatch(f, y), exclude_patterns, False) ):
                   sources.append(filename)
 
    for key in dep_add_keys:
@@ -339,7 +341,9 @@ def DoxyEmitter(source, target, env):
       out_dir = data["OUTPUT_DIRECTORY"]
       dir = env.Dir( os.path.join(source[0].dir.abspath, out_dir) )
       dir.sources = source
-      if env.GetOption('clean'): targets.append(dir)
+      if env.GetOption('clean'):
+         targets.append(dir)
+         return (targets, source)
    else:
       out_dir = '.'
 
@@ -390,8 +394,8 @@ def DoxyGenerator(source, target, env, for_signature):
 
    data = DoxyfileParse(env, source[0].abspath)
 
-   actions = [ SCons.Action.Action("cd ${SOURCE.dir}  && TOPDIR=%s ${DOXYGEN} ${SOURCE.file}"
-                                   % (relpath(source[0].dir.abspath, env.Dir('#').abspath),)) ]
+   actions = [ SCons.Action.Action("cd ${SOURCE.dir} && TOPDIR=%s ${DOXYGEN} ${SOURCE.file}"
+                                   % env.Dir('#').abspath) ]
 
    # This will add automatic 'installdox' calls.
    #
@@ -460,7 +464,7 @@ def generate(env):
       'Doxygen': doxyfile_builder,
    })
 
-   env.AppendUnique(
+   env.SetDefault(
       DOXYGEN = 'doxygen',
    )