[PATCH app-xinit 1/3] Use XORG_MANPAGE_SECTIONS rather than cpprules.in to build man pages

Gaetan Nadon memsize at videotron.ca
Fri Jun 17 11:29:54 PDT 2011


As for all other manpages, use sed rather than the C preprocessor
from the Imake days.

Use SCOMAN Automake variable and groff .if for conditional text
We can therefore remove ARCHMANDEFS
Remove man page related code from cpprules.in

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 Makefile.am  |   21 +++++++++++++++------
 configure.ac |    7 +++----
 cpprules.in  |   22 +---------------------
 startx.man   |   11 ++++++-----
 4 files changed, 25 insertions(+), 36 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index bd35ef7..6c4ef24 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,15 +30,24 @@ xinit_SOURCES =	\
         xinit.c
 
 appmandir = $(APP_MAN_DIR)
-
-appman_PRE = \
-	startx.man \
-        xinit.man
-
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+appman_PRE = startx.man  xinit.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+MAN_SUBSTS+=	-e 's|__XSERVERNAME__|$(XSERVERNAME)|g' \
+		-e 's|__XCONFIGFILE__|$(XCONFIGFILE)|g' \
+		-e 's|__XCONFIGFILEMAN__|$(XCONFIGFILEMAN)|g' \
+		-e 's|__xinitdir__|$(XINITDIR)|g' \
+		-e 's|__bindir__|$(bindir)|g' \
+		-e 's|__libdir__|$(libdir)|g' \
+		-e 's|__SCOMAN__|$(SCOMAN)|g'
 
 include $(top_srcdir)/cpprules.in
 
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
 xinitrcdir = $(XINITDIR)
 
 PROGCPPDEFS = \
diff --git a/configure.ac b/configure.ac
index 7432e6c..dbd17de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,11 +166,10 @@ fi
 AC_SUBST(STARTX_COOKIE_FLAGS)
 
 # Additional substitutions in startx, xinitrc & man pages
-ARCHMANDEFS=""
 SHELL_CMD="/bin/sh"
 XSERVERNAME="Xorg"
 XCONFIGFILE="xorg.conf"
-XCONFIGFILEMAN='${XCONFIGFILE} (__filemansuffix__)'
+XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
 case $host_os in
     cygwin*)
 	XSERVERNAME="XWin"
@@ -186,11 +185,11 @@ case $host_os in
 	;;
     *sco*)
 	SHELL_CMD="/bin/ksh"
-	ARCHMANDEFS="-D__SCOMAN__"
+	SCOMAN=1
 	;;
 esac
 AC_SUBST(SHELL_CMD)
-AC_SUBST(ARCHMANDEFS)
+AC_SUBST(SCOMAN)
 AC_SUBST(XSERVERNAME)
 AC_SUBST(XCONFIGFILE)
 AC_SUBST(XCONFIGFILEMAN)
diff --git a/cpprules.in b/cpprules.in
index 18089de..92a987d 100644
--- a/cpprules.in
+++ b/cpprules.in
@@ -13,27 +13,7 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
                        -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
                        -e '/\@\@$$/s/\@\@$$/\\/'
 
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-  XORGMANNAME = X Version 11
-
-MANDEFS =  \
-	-D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
-	-D__appmansuffix__=$(APP_MAN_SUFFIX) \
-	-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
-	-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
-	-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
-	-D__XSERVERNAME__='$(XSERVERNAME)' \
-	-D__XCONFIGFILE__='$(XCONFIGFILE)' \
-	-D__XCONFIGFILEMAN__='$(XCONFIGFILEMAN)' \
-	-D__xinitdir__=$(XINITDIR) \
-	-D__bindir__=$(bindir) \
-	-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
-
-SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp
+SUFFIXES = .cpp
 
 .cpp:
 	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
diff --git a/startx.man b/startx.man
index 641a631..0405be0 100644
--- a/startx.man
+++ b/startx.man
@@ -74,7 +74,7 @@ startx -- -dpi 100
 .PP
 startx -- -layout Multihead
 .RE
-#ifdef __SCOMAN__
+.if '__SCOMAN__'' .ig
 .PP
 To determine the client to run,
 .B startx
@@ -90,7 +90,8 @@ looks for the following files, in order:
 .I __xinitdir__/xinitrc
 .RE
 .PP
-#else
+..
+.if !'x.__SCOMAN__'x.' .ig
 .PP
 To determine the client to run,
 .B startx
@@ -102,7 +103,7 @@ the file
 in the
 .I xinit
 library directory.
-#endif
+..
 If command line client options are given, they override this
 behavior and revert to the
 .BR xinit (__appmansuffix__)
@@ -186,7 +187,7 @@ and
 .IR Xsecurity (__miscmansuffix__)
 manual pages for more information on X client/server authentication.
 .SH FILES
-#ifdef __SCOMAN__
+.if '__SCOMAN__'' .ig
 .TP 25
 .I $(HOME)/.startxrc
 Client to run.  Typically a shell script which runs many programs in
@@ -196,7 +197,7 @@ the background.
 Client to use if the user has no
 .I .startxrc
 file.
-#endif
+..
 .TP 25
 .I $(HOME)/.xinitrc
 Client to run.  Typically a shell script which runs many programs in
-- 
1.7.4.1



More information about the xorg-devel mailing list