doc: Add CHM builder script and Doxyfile.
[bertos.git] / doc / chm-builder.py
diff --git a/doc/chm-builder.py b/doc/chm-builder.py
new file mode 100644 (file)
index 0000000..8ac5b25
--- /dev/null
@@ -0,0 +1,38 @@
+"""\r
+To be used on windows platform only to generate BeRTOS .chm documentation.\r
+Requires doxygen.exe and hhc.exe to be in the system PATH.\r
+"""\r
+from __future__ import with_statement\r
+import os, sys\r
+\r
+def move(old_path, new_path):\r
+    if os.path.exists(new_path):\r
+        os.unlink(new_path)\r
+    os.rename(old_path, new_path)\r
+\r
+\r
+if sys.platform != 'win32':\r
+    print "This program can be run only on a Windows machine"\r
+    sys.exit(-1)\r
+\r
+if len(sys.argv) < 1:\r
+    print "Usage: " + sys.argv[0] + " [custom_doxyfile]"\r
+    sys.exit(-1)\r
+\r
+toc_modifier = r"doc\chm-toc-modifier.py"\r
+toc_file = r"doc\reference\html\index.hhc"\r
+bertos_toc = r"bertos-toc.hhc"\r
+\r
+if os.system("doxygen " + sys.argv[1]):\r
+    print "doxygen error"\r
+if os.system(toc_modifier + " " + toc_file + " " + bertos_toc):\r
+    print "toc-modifier error"\r
+move(bertos_toc, toc_file)\r
+\r
+# compile CHM\r
+os.system(r"hhc doc\reference\html\index.hhp")\r
+\r
+chm_target = r"doc\bertos-doc.chm"\r
+move(r"doc\reference\html\bertos-doc.chm", chm_target)\r
+\r
+\r