makefiles: Generate rules from makedep for building and installing man pages.

This commit is contained in:
Alexandre Julliard 2013-11-18 11:34:03 +01:00
parent a343edf44e
commit e2df0ab856
24 changed files with 114 additions and 94 deletions

View File

@ -32,14 +32,11 @@ ALLCROSSCFLAGS = $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
# Implicit rules
.SUFFIXES: .man.in .man @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
@MAINTAINER_MODE@.SUFFIXES: .sfd .ttf .svg .ico .bmp
.sfd.ttf:
$(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
.man.in.man:
LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
.svg.ico:
CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
@ -82,7 +79,7 @@ $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
$(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) $(IDL_R_SRCS) $(IDL_TLB_SRCS) \
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS)
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS) $(MANPAGES)
depend: dummy
$(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(PARENTSRC:%=-P%) $(EXTRAINCL) $(DEPEND_SRCS)
@ -105,17 +102,9 @@ $(WINETEST_RES): $(TESTMODULE_STRIPPED)
# Rules for man pages
MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
all: $(MANPAGES:.man.in=.man)
all: $(MANPAGES)
install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
$(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
uninstall-man-pages::
$(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
.PHONY: install-man-pages uninstall-man-pages
.PHONY: install-man-pages
# Rules for auto documentation
@ -134,7 +123,7 @@ xmlpages:: $(C_SRCS) dummy
# Rules for cleaning
clean::
$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS)
.PHONY: clean

View File

@ -70,6 +70,7 @@ LIBWINE = -L$(top_builddir)/libs/wine -lwine
LIBWINE_STATIC = $(top_builddir)/libs/wine/libwine_static.a
WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(TARGETFLAGS) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(top_builddir) @UNWINDFLAGS@
CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(CROSSTARGET:%=-b %) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(top_builddir) --lib-suffix=.cross.a
SED_CMD = LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g'
LDRPATH_INSTALL = @LDRPATH_INSTALL@
LDRPATH_LOCAL = @LDRPATH_LOCAL@
INSTALL = @INSTALL@ $(INSTALL_FLAGS)

View File

@ -14,20 +14,15 @@ PROGRAMS = \
wine64 \
wine64-preloader
MANPAGE = wine.man
EXTRA_MANPAGES = \
wine.de.UTF-8.man \
wine.fr.UTF-8.man \
wine.pl.UTF-8.man
MANPAGES = \
wine.de.UTF-8.man.in \
wine.fr.UTF-8.man.in \
wine.man.in \
wine.pl.UTF-8.man.in
INSTALLDIRS = \
$(DESTDIR)$(bindir) \
$(DESTDIR)$(datadir)/wine \
$(DESTDIR)$(mandir)/man$(prog_manext) \
$(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext) \
$(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext) \
$(DESTDIR)$(mandir)/pl.UTF-8/man$(prog_manext)
$(DESTDIR)$(datadir)/wine
@MAKE_RULES@
@ -36,13 +31,3 @@ INSTALLDIRS = \
# Make sure that make_makefiles sees the generated rules
install install-lib::
clean::
install-man-pages:: $(EXTRA_MANPAGES) $(INSTALLDIRS) dummy
$(INSTALL_DATA) wine.de.UTF-8.man $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wine.$(prog_manext)
$(INSTALL_DATA) wine.fr.UTF-8.man $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wine.$(prog_manext)
$(INSTALL_DATA) wine.pl.UTF-8.man $(DESTDIR)$(mandir)/pl.UTF-8/man$(prog_manext)/wine.$(prog_manext)
uninstall::
$(RM) $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wine.$(prog_manext)
$(RM) $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wine.$(prog_manext)
$(RM) $(DESTDIR)$(mandir)/pl.UTF-8/man$(prog_manext)/wine.$(prog_manext)

View File

@ -8,7 +8,7 @@ C_SRCS = \
RC_SRCS = rsrc.rc
MANPAGE = msiexec.man
MANPAGES = msiexec.man.in
SVG_SRCS = msiexec.svg

View File

@ -12,7 +12,7 @@ C_SRCS = \
RC_SRCS = notepad.rc
PO_SRCS = notepad.rc
MANPAGE = notepad.man
MANPAGES = notepad.man.in
SVG_SRCS = notepad.svg

View File

@ -21,7 +21,7 @@ C_SRCS = \
RC_SRCS = regedit.rc
PO_SRCS = regedit.rc
MANPAGE = regedit.man
MANPAGES = regedit.man.in
SVG_SRCS = regedit.svg

View File

@ -7,6 +7,6 @@ C_SRCS = \
RC_SRCS = regsvr32.rc
MANPAGE = regsvr32.man
MANPAGES = regsvr32.man.in
@MAKE_PROG_RULES@

View File

@ -10,6 +10,6 @@ C_SRCS = \
RC_SRCS = wineboot.rc
PO_SRCS = wineboot.rc
MANPAGE = wineboot.man
MANPAGES = wineboot.man.in
@MAKE_PROG_RULES@

View File

@ -18,7 +18,7 @@ C_SRCS = \
RC_SRCS = winecfg.rc
PO_SRCS = winecfg.rc
MANPAGE = winecfg.man
MANPAGES = winecfg.man.in
SVG_SRCS = \
logo.svg \

View File

@ -13,6 +13,6 @@ C_SRCS = \
RC_SRCS = wineconsole.rc
PO_SRCS = wineconsole.rc
MANPAGE = wineconsole.man
MANPAGES = wineconsole.man.in
@MAKE_PROG_RULES@

View File

@ -34,6 +34,6 @@ PO_SRCS = winedbg.rc
LEX_SRCS = debug.l
BISON_SRCS = dbg.y
MANPAGE = winedbg.man
MANPAGES = winedbg.man.in
@MAKE_PROG_RULES@

View File

@ -10,7 +10,7 @@ C_SRCS = \
RC_SRCS = winefile.rc
PO_SRCS = winefile.rc
MANPAGE = winefile.man
MANPAGES = winefile.man.in
SVG_SRCS = winefile.svg

View File

@ -10,7 +10,7 @@ C_SRCS = \
RC_SRCS = winemine.rc
PO_SRCS = winemine.rc
MANPAGE = winemine.man
MANPAGES = winemine.man.in
SVG_SRCS = winemine.svg

View File

@ -3,6 +3,6 @@ APPMODE = -mconsole -municode
C_SRCS = winepath.c
MANPAGE = winepath.man
MANPAGES = winepath.man.in
@MAKE_PROG_RULES@

View File

@ -47,14 +47,12 @@ C_SRCS = \
PROGRAMS = wineserver wineserver-installed
MANPAGE = wineserver.man
EXTRA_MANPAGES = wineserver.de.UTF-8.man wineserver.fr.UTF-8.man
MANPAGES = \
wineserver.de.UTF-8.man.in \
wineserver.fr.UTF-8.man.in \
wineserver.man.in
INSTALLDIRS = \
$(DESTDIR)$(bindir) \
$(DESTDIR)$(mandir)/man$(prog_manext) \
$(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext) \
$(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)
@ -69,11 +67,5 @@ wineserver-installed: $(OBJS)
install install-lib:: wineserver-installed $(DESTDIR)$(bindir) install-man-pages
$(INSTALL_PROGRAM) wineserver-installed $(DESTDIR)$(bindir)/wineserver
install-man-pages:: $(EXTRA_MANPAGES) $(INSTALLDIRS)
$(INSTALL_DATA) wineserver.de.UTF-8.man $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wineserver.$(prog_manext)
$(INSTALL_DATA) wineserver.fr.UTF-8.man $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wineserver.$(prog_manext)
uninstall::
$(RM) $(DESTDIR)$(bindir)/wineserver
$(RM) $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/wineserver.$(prog_manext)
$(RM) $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/wineserver.$(prog_manext)

View File

@ -8,11 +8,10 @@ PROGRAMS = \
sfnt2fnt$(EXEEXT) \
wineapploader
MANPAGE = winemaker.man
EXTRA_MANPAGES = \
winemaker.de.UTF-8.man \
winemaker.fr.UTF-8.man
MANPAGES = \
winemaker.de.UTF-8.man.in \
winemaker.fr.UTF-8.man.in \
winemaker.man.in
C_SRCS = \
fnt2fon.c \
@ -23,10 +22,7 @@ C_SRCS = \
INSTALLDIRS = \
$(DESTDIR)$(bindir) \
$(DESTDIR)$(datadir)/applications \
$(DESTDIR)$(mandir)/man$(prog_manext) \
$(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext) \
$(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)
$(DESTDIR)$(datadir)/applications
UPDATE_DESKTOP_DATABASE = update-desktop-database
@ -56,13 +52,6 @@ install install-lib:: $(DESTDIR)$(datadir)/applications
install install-dev:: $(DESTDIR)$(bindir) install-man-pages
$(INSTALL_SCRIPT) $(srcdir)/winemaker $(DESTDIR)$(bindir)/winemaker
install-man-pages:: $(EXTRA_MANPAGES) $(INSTALLDIRS)
$(INSTALL_DATA) winemaker.de.UTF-8.man $(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/winemaker.$(prog_manext)
$(INSTALL_DATA) winemaker.fr.UTF-8.man $(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/winemaker.$(prog_manext)
uninstall::
$(RM) $(DESTDIR)$(datadir)/applications/wine.desktop \
$(DESTDIR)$(bindir)/winemaker \
$(DESTDIR)$(mandir)/de.UTF-8/man$(prog_manext)/winemaker.$(prog_manext) \
$(DESTDIR)$(mandir)/fr.UTF-8/man$(prog_manext)/winemaker.$(prog_manext)
$(RM) $(DESTDIR)$(datadir)/applications/wine.desktop $(DESTDIR)$(bindir)/winemaker
-$(UPDATE_DESKTOP_DATABASE)

View File

@ -322,15 +322,14 @@ sub parse_makefile($)
$make{"=rules"} = $makerules{$var} || $var;
next;
}
if (/^\s*(MODULE|IMPORTLIB|TESTDLL|MANPAGE|PARENTSRC)\s*=\s*(.*)/)
if (/^\s*(MODULE|IMPORTLIB|TESTDLL|PARENTSRC)\s*=\s*(.*)/)
{
my $var = $1;
$make{$var} = $2;
${$make{"=flags"}}{"implib"} = 1 if $var eq "IMPORTLIB";
${$make{"=flags"}}{"manpage"} = 1 if $var eq "MANPAGE";
next;
}
if (/^\s*(BISON_SRCS|LEX_SRCS|IDL_[CHIPRS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|C_SRCS|OBJC_SRCS|MC_SRCS|RC_SRCS|PO_SRCS|SVG_SRCS|PROGRAMS)\s*=\s*(.*)/)
if (/^\s*(BISON_SRCS|LEX_SRCS|IDL_[CHIPRS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|C_SRCS|OBJC_SRCS|MC_SRCS|RC_SRCS|PO_SRCS|SVG_SRCS|PROGRAMS|MANPAGES)\s*=\s*(.*)/)
{
my $var = $1;
my @list = split(/\s+/, $2);
@ -498,6 +497,11 @@ sub assign_sources_to_makefiles(@)
push @{${$make}{"=IDL_TLB_SRCS"}}, $name if defined $flags{"typelib"};
${${$make}{"=flags"}}{"clean"} = 1;
}
elsif ($name =~ /\.man\.in$/)
{
push @{${$make}{"=MANPAGES"}}, $name;
${${$make}{"=flags"}}{"manpage"} = 1;
}
}
}
@ -624,6 +628,7 @@ sub update_makefiles(@)
replace_makefile_variable( $file, "XTEMPLATE_SRCS" );
replace_makefile_variable( $file, "IMPLIB_SRCS" );
replace_makefile_variable( $file, "SRCDIR_INCLUDES" );
replace_makefile_variable( $file, "MANPAGES" );
}
push @lines, "dnl End of auto-generated output commands\n";

View File

@ -928,6 +928,29 @@ static void parse_rc_file( struct incl_file *pFile, FILE *file )
}
/*******************************************************************
* parse_man_page
*/
static void parse_man_page( struct incl_file *source, FILE *file )
{
char *p, *buffer;
/* make sure it gets rebuilt when the version changes */
add_include( source, "config.h", 1 );
input_line = 0;
while ((buffer = get_line( file )))
{
if (strncmp( buffer, ".TH", 3 )) continue;
if (!(p = strtok( buffer, " \t" ))) continue; /* .TH */
if (!(p = strtok( NULL, " \t" ))) continue; /* program name */
if (!(p = strtok( NULL, " \t" ))) continue; /* man section */
source->sourcename = xstrdup( p ); /* abuse source name to store section */
return;
}
}
/*******************************************************************
* parse_generated_idl
*/
@ -1005,6 +1028,8 @@ static void parse_file( struct incl_file *source, int src )
parse_c_file( source, file );
else if (strendswith( source->filename, ".rc" ))
parse_rc_file( source, file );
else if (strendswith( source->filename, ".man.in" ))
parse_man_page( source, file );
fclose(file);
input_file_name = NULL;
}
@ -1147,11 +1172,12 @@ static void output_include( struct incl_file *pFile, struct incl_file *owner, in
static void output_sources(void)
{
struct incl_file *source;
struct strarray clean_files;
struct strarray clean_files, subdirs;
int i, column, po_srcs = 0, mc_srcs = 0;
int is_test = find_src_file( "testlist.o" ) != NULL;
strarray_init( &clean_files );
strarray_init( &subdirs );
LIST_FOR_EACH_ENTRY( source, &sources, struct incl_file, entry )
{
@ -1242,6 +1268,32 @@ static void output_sources(void)
}
column += output( " %s", source->filename );
}
else if (!strcmp( ext, "in" )) /* man page */
{
if (strendswith( obj, ".man" ) && source->sourcename)
{
char *dir, *dest = replace_extension( obj, 4, "" );
char *lang = strchr( dest, '.' );
if (lang)
{
*lang++ = 0;
dir = strmake( "$(DESTDIR)$(mandir)/%s/man%s", lang, source->sourcename );
}
else dir = strmake( "$(DESTDIR)$(mandir)/man%s", source->sourcename );
output( "install-man-pages:: %s %s\n", obj, dir );
output( "\t$(INSTALL_DATA) %s %s/%s.%s\n",
obj, dir, dest, source->sourcename );
output( "uninstall::\n" );
output( "\t$(RM) %s/%s.%s\n",
dir, dest, source->sourcename );
free( dest );
strarray_add( &subdirs, dir );
}
strarray_add( &clean_files, xstrdup(obj) );
output( "%s: %s\n", obj, source->filename );
output( "\t$(SED_CMD) %s >$@ || ($(RM) $@ && false)\n", source->filename );
column += output( "%s:", obj );
}
else if (!strcmp( ext, "tlb" ) || !strcmp( ext, "res" ) || !strcmp( ext, "pot" ))
{
continue; /* nothing to do for typelib files */
@ -1348,6 +1400,13 @@ static void output_sources(void)
for (i = 0; i < clean_files.count; i++) output_filename( clean_files.str[i], &column );
output( "\n" );
}
if (subdirs.count)
{
for (i = column = 0; i < subdirs.count; i++) output_filename( subdirs.str[i], &column );
output( ":\n" );
output( "\t$(MKDIR_P) -m 755 $@\n" );
}
}

View File

@ -1,5 +1,5 @@
PROGRAMS = widl$(EXEEXT)
MANPAGE = widl.man
MANPAGES = widl.man.in
C_SRCS = \
client.c \
@ -20,7 +20,7 @@ LEX_SRCS = parser.l
BISON_SRCS = parser.y
EXTRADEFS = -DDEFAULT_INCLUDE_DIR=\"$(includedir)/windows/\"
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)

View File

@ -1,5 +1,5 @@
PROGRAMS = winebuild$(EXEEXT)
MANPAGE = winebuild.man
MANPAGES = winebuild.man.in
C_SRCS = \
import.c \
@ -12,7 +12,7 @@ C_SRCS = \
spec32.c \
utils.c
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)

View File

@ -1,5 +1,5 @@
PROGRAMS = winedump$(EXEEXT)
MANPAGE = winedump.man
MANPAGES = winedump.man.in
C_SRCS = \
debug.c \
@ -23,7 +23,7 @@ C_SRCS = \
symbol.c \
tlb.c
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)

View File

@ -12,13 +12,13 @@ PROGRAMS = \
winegcc$(EXEEXT) \
wineg++$(EXEEXT)
MANPAGE = winegcc.man
MANPAGES = winegcc.man.in
C_SRCS = \
utils.c \
winegcc.c
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)

View File

@ -1,5 +1,5 @@
PROGRAMS = wmc$(EXEEXT)
MANPAGE = wmc.man
MANPAGES = wmc.man.in
ALL_LIBS = @LIBGETTEXTPO@ $(LIBWINE_STATIC) $(LIBPORT)
C_SRCS = \
@ -12,7 +12,7 @@ C_SRCS = \
BISON_SRCS = mcy.y
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)

View File

@ -1,6 +1,6 @@
EXTRADEFS = -DINCLUDEDIR="\"$(includedir)\""
PROGRAMS = wrc$(EXEEXT)
MANPAGE = wrc.man
MANPAGES = wrc.man.in
ALL_LIBS = @LIBGETTEXTPO@ $(LIBWPP) $(LIBWINE_STATIC) $(LIBPORT)
C_SRCS = \
@ -17,7 +17,7 @@ C_SRCS = \
LEX_SRCS = parser.l
BISON_SRCS = parser.y
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
INSTALLDIRS = $(DESTDIR)$(bindir)
all: $(PROGRAMS)