summaryrefslogtreecommitdiff
path: root/xc/config/cf/lnxdoc.rules
blob: 3b63ccbaa9eaf6e361dd3a1d6c69d3709ae3abe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
XCOMM $XFree86: xc/config/cf/lnxdoc.rules,v 3.19 2000/02/26 05:19:44 dawes Exp $
XCOMM
XCOMM Rules for formatting Linuxdoc-SGML documentation
XCOMM

#include <lnxdoc.tmpl>

#ifdef DontInstallLinuxDoc
#define LinuxDocInstall(file,dest)	/* do nothing */
#define LinuxDocInstallMultiple(files,dest)	/* do nothing */
#else
#define LinuxDocInstall(file,dest)	InstallNonExecFile(file,dest)
#define LinuxDocInstallMultiple(files,dest)				@@\
InstallMultipleDest(install,files,dest)
#endif

/* Version for sgmlfmt */

#if BuildLinuxDocPS
#define LinuxDocSgmlToPs(sgmlfile,base) 				@@\
AllTarget(base.ps)							@@\
									@@\
base.ps: sgmlfile $(SGMLDEPENDS)					@@\
	RemoveFile(_$@ $@)						@@\
	@(BASE=`basename sgmlfile .sgml`;\				@@\
	  set -x;\							@@\
	  RemoveFile($$BASE.ps);\					@@\
	  $(SGMLFMTCMD) -f ps sgmlfile && \				@@\
		$(MV) $$BASE.ps _$@ && $(MV) _$@ $@)			@@\
									@@\
LinuxDocInstall(base.ps,$(XFREE86PSDOCDIR))				@@\
									@@\
clean::									@@\
	RemoveFile(Concat(_,base.ps) base.ps)
#else
#define LinuxDocSgmlToPs(sgmlfile,base) /**/
#endif

#if BuildLinuxDocText
#define LinuxDocSgmlToText(sgmlfile,textfile)				@@\
AllTarget(textfile)							@@\
									@@\
textfile: sgmlfile $(SGMLDEPENDS)					@@\
	RemoveFiles(_$@ $@)						@@\
	@(BASE=`basename sgmlfile .sgml`;\				@@\
	  set -x;\							@@\
	  RemoveFile($$BASE.latin1);\					@@\
	  $(SGMLFMTCMD) -f latin1 -b -n sgmlfile && \			@@\
	  $(XFREE86IDENTFIX) < $$BASE.latin1 > _$@ && $(MV) _$@ $@ && \	@@\
	  RemoveFile($$BASE.latin1))					@@\
									@@\
LinuxDocInstall(textfile,$(XFREE86DOCDIR))				@@\
									@@\
clean::									@@\
	@(file=textfile; set -x; RemoveFiles(_$$file $$file))
#else
#define LinuxDocSgmlToText(sgmlfile,textfile) /**/
#endif

#if BuildLinuxDocHtml
#define LinuxDocSgmlToHtml(sgmlfile,base)				@@\
AllTarget(base.html)							@@\
									@@\
base.html: sgmlfile $(SGMLDEPENDS)					@@\
	@if [ sgmlfile != base.sgml ]; then $(LN) sgmlfile base.sgml; fi @@\
	RemoveFiles(base*.html)						@@\
	$(SGMLFMTCMD) -f html base.sgml || RemoveFile($@)		@@\
	@if [ sgmlfile != base.sgml ]; then RemoveFile(base.sgml); fi	@@\
									@@\
LinuxDocInstallMultiple(base*.html,$(XFREE86HTMLDOCDIR))		@@\
									@@\
clean::									@@\
	RemoveFiles(base*.html)
#else
#define LinuxDocSgmlToHtml(sgmlfile,base) /**/
#endif

/*
 * Rule for maintainers to use to updated formatted copies of docs in the
 * source tree.  Use with care.
 */

#ifndef UpdateFormattedDoc
#define UpdateFormattedDoc(textfile)					@@\
update.docs:: textfile							@@\
	-@if [ -f $(FORMATTEDDIR)/textfile ]; then \			@@\
	    if [ "$(FORCEUPDATE)" = yes ]; then set -x; \		@@\
		cp textfile $(FORMATTEDDIR)/textfile; \			@@\
		echo "" >> $(FORMATTEDDIR)/textfile; \			@@\
		echo "\$$XFree86\$$" >> $(FORMATTEDDIR)/textfile; \	@@\
	    else \							@@\
		$(RM) __tmp1__ __tmp2__; \				@@\
		grep "Generated from XFree86:" textfile > __tmp1__; \	@@\
		grep "Generated from XFree86:" $(FORMATTEDDIR)/textfile > __tmp2__; \	@@\
		if diff __tmp1__ __tmp2__ > /dev/null 2>&1; then :; \ @@\
		else set -x; \						@@\
			cp textfile $(FORMATTEDDIR)/textfile ; \	@@\
			echo "" >> $(FORMATTEDDIR)/textfile; \		@@\
			echo "\$$XFree86\$$" >> $(FORMATTEDDIR)/textfile; \ @@\
		fi; \							@@\
	    fi; \							@@\
	fi								@@\
	@$(RM) __tmp1__ __tmp2__
#endif

#define LinuxDocTargetLong(sgmlfile,textfile,base)			@@\
LinuxDocSgmlToText(sgmlfile,textfile)					@@\
LinuxDocSgmlToHtml(sgmlfile,base)					@@\
LinuxDocSgmlToPs(sgmlfile,base)						@@\
UpdateFormattedDoc(textfile)

#define LinuxDocReadmeTarget(base)					@@\
LinuxDocTargetLong(base.sgml,ReadmeFile(base),base)

#define LinuxDocTarget(base)						@@\
LinuxDocTargetLong(base.sgml,base,base)