Alexandre Julliard : makefiles: Add support for parent source directory in c2man.

Alexandre Julliard julliard at winehq.org
Tue Nov 19 13:28:35 CST 2013


Module: wine
Branch: master
Commit: abc62981590bf69fd581961a13a8fd5d0b6e176f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=abc62981590bf69fd581961a13a8fd5d0b6e176f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov 19 12:48:30 2013 +0100

makefiles: Add support for parent source directory in c2man.

---

 Make.rules.in  |   16 ++++++++--------
 tools/c2man.pl |   14 +++++++++++---
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Make.rules.in b/Make.rules.in
index b895c8a..a0a4ece 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -108,17 +108,17 @@ all: $(MANPAGES:.man.in=.man)
 
 # Rules for auto documentation
 
-manpages:: $(C_SRCS) dummy
-	$(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) $(INCLUDES) -S$(api_manext) $(MAINSPEC:%=-w %) $(C_SRCS)
+manpages:: dummy
+	$(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) $(PARENTSRC:%=-P%) -I$(top_srcdir)/include $(MAINSPEC:%=-w %) $(C_SRCS)
 
-htmlpages:: $(C_SRCS) dummy
-	$(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
+htmlpages:: dummy
+	$(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(PARENTSRC:%=-P%) -I$(top_srcdir)/include -Th $(MAINSPEC:%=-w %) $(C_SRCS)
 
-sgmlpages:: $(C_SRCS) dummy
-	$(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
+sgmlpages:: dummy
+	$(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(PARENTSRC:%=-P%) -I$(top_srcdir)/include -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
 
-xmlpages:: $(C_SRCS) dummy
-	$(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
+xmlpages:: dummy
+	$(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(PARENTSRC:%=-P%) -I$(top_srcdir)/include -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
 
 # Rules for cleaning
 
diff --git a/tools/c2man.pl b/tools/c2man.pl
index 0668ee2..a9c4150 100755
--- a/tools/c2man.pl
+++ b/tools/c2man.pl
@@ -48,7 +48,8 @@ my $EXPORT_FLAGS    = 4;  # Flags - see above.
 # Options
 my $opt_output_directory = "man3w"; # All default options are for nroff (man pages)
 my $opt_manual_section = "3w";
-my $opt_source_dir = "";
+my $opt_source_dir = ".";
+my $opt_parent_dir = "";
 my $opt_wine_root_dir = "";
 my $opt_output_format = "";         # '' = nroff, 'h' = html, 's' = sgml, 'x' = xml
 my $opt_output_empty = 0;           # Non-zero = Create 'empty' comments (for every implemented function)
@@ -251,8 +252,10 @@ sub process_source_file($)
     print "Processing ".$source_file."\n";
   }
   open(SOURCE_FILE,"<$source_file")
-  || (($opt_source_dir ne "")
+  || (($opt_source_dir ne ".")
       && open(SOURCE_FILE,"<$opt_source_dir/$source_file"))
+  || (($opt_parent_dir ne "")
+      && open(SOURCE_FILE,"<$opt_source_dir/$opt_parent_dir/$source_file"))
   || die "couldn't open ".$source_file."\n";
 
   # Add this source file to the list of source files
@@ -2241,7 +2244,8 @@ sub usage()
         " -Ts      : Output SGML (DocBook source) instead of a man page\n",
         " -C <dir> : Source directory, to find source files if they are not found in the\n",
         "            current directory. Default is \"",$opt_source_dir,"\"\n",
-        " -R <dir> : Root of build directory, default is \"",$opt_wine_root_dir,"\"\n",
+        " -P <dir> : Parent source directory.\n",
+        " -R <dir> : Root of build directory.\n",
         " -o <dir> : Create output in <dir>, default is \"",$opt_output_directory,"\"\n",
         " -s <sect>: Set manual section to <sect>, default is ",$opt_manual_section,"\n",
         " -e       : Output \"FIXME\" documentation from empty comments.\n",
@@ -2291,6 +2295,10 @@ while(defined($_ = shift @ARGV))
                      if ($_ ne "") { $opt_source_dir = $_; }
                      last;
                    };
+      s/^P// && do {
+                     if ($_ ne "") { $opt_parent_dir = $_; }
+                     last;
+                   };
       s/^R// && do { if ($_ =~ /^\//) { $opt_wine_root_dir = $_; }
                      else { $opt_wine_root_dir = `cd $pwd/$_ && pwd`; }
                      $opt_wine_root_dir =~ s/\n//;




More information about the wine-cvs mailing list