man: rework the Makefile.am

Remove GNU make specific constructs and take into consideration that
Solaris man 7 is not the same as Linux man 7.

This commit introduces a dependency of xorg-macros 1.12 (released 4+
years ago) which is used to handle the above man section discrepancies.

Cc: Niveditha Rau <niveditha.rau@oracle.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Emil Velikov 2015-04-06 19:02:38 +01:00
parent 41eb131dfe
commit e2b531866f
3 changed files with 58 additions and 42 deletions

View File

@ -73,6 +73,12 @@ if HAVE_TEGRA
TEGRA_SUBDIR = tegra TEGRA_SUBDIR = tegra
endif endif
if BUILD_MANPAGES
if HAVE_MANPAGES_STYLESHEET
MAN_SUBDIR = man
endif
endif
SUBDIRS = \ SUBDIRS = \
. \ . \
$(LIBKMS_SUBDIR) \ $(LIBKMS_SUBDIR) \
@ -84,7 +90,7 @@ SUBDIRS = \
$(FREEDRENO_SUBDIR) \ $(FREEDRENO_SUBDIR) \
$(TEGRA_SUBDIR) \ $(TEGRA_SUBDIR) \
tests \ tests \
man $(MAN_SUBDIR)
libdrm_la_LTLIBRARIES = libdrm.la libdrm_la_LTLIBRARIES = libdrm.la
libdrm_ladir = $(libdir) libdrm_ladir = $(libdir)

View File

@ -29,6 +29,13 @@ AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
# Require xorg-macros minimum of 1.12 for XORG_WITH_XSLTPROC
m4_ifndef([XORG_MACROS_VERSION],
[m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.12)
XORG_WITH_XSLTPROC
XORG_MANPAGE_SECTIONS
AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2]) AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2])
# Enable quiet compiles on automake 1.11. # Enable quiet compiles on automake 1.11.
@ -378,9 +385,8 @@ AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
# xsltproc for docbook manpages # xsltproc for docbook manpages
AC_ARG_ENABLE([manpages], AC_ARG_ENABLE([manpages],
AS_HELP_STRING([--disable-manpages], [disable manpages @<:@default=enabled@:>@]), AS_HELP_STRING([--enable-manpages], [enable manpages @<:@default=auto@:>@]),
[MANS=$enableval], [MANS=auto]) [MANS=$enableval], [MANS=auto])
AC_PATH_PROG(XSLTPROC, xsltproc)
AM_CONDITIONAL([BUILD_MANPAGES], [test "x$XSLTPROC" != "x" -a "x$MANS" != "xno"]) AM_CONDITIONAL([BUILD_MANPAGES], [test "x$XSLTPROC" != "x" -a "x$MANS" != "xno"])
# check for offline man-pages stylesheet # check for offline man-pages stylesheet

View File

@ -1,63 +1,67 @@
# #
# This generates man-pages out of the Docbook XML files. Simply add your files # This generates man-pages out of the Docbook XML files. Simply add your files
# to the $MANPAGES array. If aliases are created, please add them to the # to the relevant *man_PRE array. If aliases are created, please add them to the
# MANPAGES_ALIASES array so they get installed correctly. # *man_aliases_PRE array so they get installed correctly.
# #
MANPAGES = \ libman_PRE = \
drm.7 \ drmAvailable.xml \
drm-kms.7 \ drmHandleEvent.xml \
drm-memory.7 \ drmModeGetResources.xml
drmAvailable.3 \
drmHandleEvent.3 \ miscman_PRE = \
drmModeGetResources.3 drm.xml \
MANPAGES_ALIASES = \ drm-kms.xml \
drm-mm.7 \ drm-memory.xml
drm-gem.7 \
drm-ttm.7 miscman_aliases_PRE = \
drm-mm.xml \
drm-gem.xml \
drm-ttm.xml
libmandir = $(LIB_MAN_DIR)
miscmandir = $(MISC_MAN_DIR)
miscman_aliasesdir = $(MISC_MAN_DIR)
libman_DATA = $(libman_PRE:.xml=.$(LIB_MAN_SUFFIX))
miscman_DATA = $(miscman_PRE:.xml=.$(MISC_MAN_SUFFIX))
miscman_aliases_DATA = $(miscman_aliases_PRE:.xml=.$(MISC_MAN_SUFFIX))
XML_FILES = \ XML_FILES = \
$(patsubst %.1,%.xml,$(patsubst %.3,%.xml,$(patsubst %.5,%.xml,$(patsubst %.7,%.xml,$(MANPAGES))))) $(libman_PRE) \
$(miscman_PRE)
MAN_FILES = \
$(libman_DATA) \
$(miscman_DATA) \
$(miscman_aliases_DATA)
EXTRA_DIST = $(XML_FILES) EXTRA_DIST = $(XML_FILES)
CLEANFILES = $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup CLEANFILES = $(MAN_FILES) .man_fixup
man_MANS =
if BUILD_MANPAGES
if HAVE_MANPAGES_STYLESHEET
man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
XSLTPROC_FLAGS = \ XSLTPROC_FLAGS = \
--stringparam man.authors.section.enabled 0 \ --stringparam man.authors.section.enabled 0 \
--stringparam man.copyright.section.enabled 0 \ --stringparam man.copyright.section.enabled 0 \
--stringparam funcsynopsis.style ansi \ --stringparam funcsynopsis.style ansi \
--stringparam man.output.quietly 1 \ --stringparam man.output.quietly 1 \
--nonet --nonet \
$(MANPAGES_STYLESHEET)
XSLTPROC_PROCESS_MAN = \ XSLTPROC_PROCESS_MAN = \
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ $(AM_V_GEN)$(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) "$<" && \
$(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(MANPAGES_STYLESHEET) "$<" && \
touch .man_fixup touch .man_fixup
# Force .man_fixup if $(MANPAGES) are not built # Force .man_fixup if $(miscman_DATA) are not built
.man_fixup: | $(MANPAGES) .man_fixup: | $(miscman_DATA)
@touch .man_fixup $(AM_V_GEN)touch .man_fixup
$(MANPAGES_ALIASES): $(MANPAGES) .man_fixup $(miscman_aliases_DATA): $(miscman_DATA) .man_fixup
$(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
%.1: $(top_srcdir)/man/%.xml SUFFIXES = .$(LIB_MAN_SUFFIX) .$(MISC_MAN_SUFFIX) .xml
.xml.$(LIB_MAN_SUFFIX):
$(XSLTPROC_PROCESS_MAN) $(XSLTPROC_PROCESS_MAN)
%.3: $(top_srcdir)/man/%.xml .xml.$(MISC_MAN_SUFFIX):
$(XSLTPROC_PROCESS_MAN) $(XSLTPROC_PROCESS_MAN)
%.5: $(top_srcdir)/man/%.xml
$(XSLTPROC_PROCESS_MAN)
%.7: $(top_srcdir)/man/%.xml
$(XSLTPROC_PROCESS_MAN)
endif # HAVE_MANPAGES_STYLESHEET
endif # BUILD_MANPAGES