Makefile.am revision 1fd23544
1#
2# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3# 
4# Permission to use, copy, modify, distribute, and sell this software and its
5# documentation for any purpose is hereby granted without fee, provided that
6# the above copyright notice appear in all copies and that both that
7# copyright notice and this permission notice appear in supporting
8# documentation.
9# 
10# The above copyright notice and this permission notice shall be included
11# in all copies or substantial portions of the Software.
12# 
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16# IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
17# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19# OTHER DEALINGS IN THE SOFTWARE.
20# 
21# Except as contained in this notice, the name of the copyright holders shall
22# not be used in advertising or otherwise to promote the sale, use or
23# other dealings in this Software without prior written authorization
24# from the copyright holders.
25# 
26
27drivermandir = $(DRIVER_MAN_DIR)
28
29driverman_PRE = @DRIVER_NAME@.man
30
31driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
32
33EXTRA_DIST = @DRIVER_NAME@.man
34
35CLEANFILES = $(driverman_DATA)
36
37SED = sed
38
39# Strings to replace in man pages
40XORGRELSTRING = @PACKAGE_STRING@
41  XORGMANNAME = X Version 11
42
43MANDEFS =  \
44	-D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
45	-D__appmansuffix__=$(APP_MAN_SUFFIX) \
46	-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
47	-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
48	-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
49	-D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
50	-D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
51	-D__xconfigfile__=xorg.conf \
52	-D__xservername__=Xorg
53
54# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
55# to cpp, because that trick does not work on all ANSI C preprocessors.
56# Delete line numbers from the cpp output (-P is not portable, I guess).
57# Allow XCOMM to be preceded by whitespace and provide a means of generating
58# output lines with trailing backslashes.
59# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
60
61CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
62                       -e '/^\#line  *[0-9][0-9]*  *.*$$/d' \
63                       -e '/^[         ]*XCOMM$$/s/XCOMM/\#/' \
64                       -e '/^[         ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
65                       -e '/^[         ]*XHASH/s/XHASH/\#/' \
66                       -e '/\@\@$$/s/\@\@$$/\\/'
67
68SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
69
70.man.$(DRIVER_MAN_SUFFIX):
71	$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
72
73