From abc62981590bf69fd581961a13a8fd5d0b6e176f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 19 Nov 2013 12:48:30 +0100 Subject: [PATCH] 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 b895c8ac42e..a0a4ece2849 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 0668ee2ee90..a9c4150ea1e 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 : Source directory, to find source files if they are not found in the\n", " current directory. Default is \"",$opt_source_dir,"\"\n", - " -R : Root of build directory, default is \"",$opt_wine_root_dir,"\"\n", + " -P : Parent source directory.\n", + " -R : Root of build directory.\n", " -o : Create output in , default is \"",$opt_output_directory,"\"\n", " -s : Set manual section to , 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//;