1#
2# Copyright (c) 2007, Oracle and/or its affiliates.
3#
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8# and/or sell copies of the Software, and to permit persons to whom the
9# Software is furnished to do so, subject to the following conditions:
10#
11# The above copyright notice and this permission notice (including the next
12# paragraph) shall be included in all copies or substantial portions of the
13# Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21# DEALINGS IN THE SOFTWARE.
22#
23
24libmandir = $(LIB_MAN_DIR)
25
26libman_xml = XTest.xml
27
28libman_PRE =	\
29	XTestQueryExtension.man \
30	XTestCompareCursorWithWindow.man \
31	XTestCompareCurrentCursorWithWindow.man \
32	XTestFakeKeyEvent.man \
33	XTestFakeButtonEvent.man \
34	XTestFakeMotionEvent.man \
35	XTestFakeRelativeMotionEvent.man \
36	XTestGrabControl.man \
37	XTestSetGContextOfGC.man \
38	XTestSetVisualIDOfVisual.man \
39	XTestDiscard.man
40
41EXTRA_DIST = $(libman_PRE) $(libman_xml) x.stamp
42
43CLEANFILES = $(libman_DATA)
44
45MAINTAINERCLEANFILES = $(libman_PRE)
46
47if INSTALL_MANPAGES
48libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@)
49endif
50
51# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
52SUFFIXES = .$(LIB_MAN_SUFFIX) .man
53
54.man.$(LIB_MAN_SUFFIX):
55	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
56
57# This is ugly, but handling of tools with multiple outputs in make is a
58# huge PITA. The commands below are taken from the automake manual:
59# http://www.gnu.org/software/automake/manual/automake.html#Multiple-Outputs
60if HAVE_XMLTO
61x.stamp: $(libman_xml)
62	@rm -f x.tmp
63	@touch x.tmp
64	$(XMLTO) man $^
65	@for man in $(libman_PRE); do \
66	  out=`echo $$man | sed 's/\.man/.__libmansuffix__/'`; \
67	  echo mv -f $$out $$man; \
68	  mv -f $$out $$man || exit 1; \
69	done
70	@mv -f x.tmp $@
71$(libman_PRE): x.stamp
72	@if test -f $@; then :; else \
73	  rm -f $<; \
74	  $(MAKE) $(AM_MAKEFLAGS) $<; \
75	fi
76CLEANFILES += x.tmp
77MAINTAINERCLEANFILES += x.stamp
78endif # HAVE_XMLTO
79