* Mono.Documentation/monodocs2html.cs: Enable debug output in
[mono.git] / mcs / tools / mdoc / Makefile
1 thisdir = tools/mdoc
2 SUBDIRS = 
3 include ../../build/rules.make
4
5 MDOC_COMMON_FLAGS = \
6         /resource:../monodoc/Resources/mdoc-html-format.xsl,mdoc-html-format.xsl    \
7         /resource:../monodoc/Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl      \
8         /resource:../monodoc/Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl  \
9         /resource:../monodoc/Resources/mono-ecma-css.xsl,mono-ecma-css.xsl          \
10         /resource:Resources/defaulttemplate.xsl,defaulttemplate.xsl                 \
11         /resource:Resources/monodoc-ecma.xsd,monodoc-ecma.xsd                       \
12         /resource:Resources/overview.xsl,overview.xsl                               \
13         /resource:Resources/stylesheet.xsl,stylesheet.xsl                           \
14         /r:System.Web.dll                                                           \
15         /r:ICSharpCode.SharpZipLib.dll                                              \
16         /r:$(topdir)/class/lib/net_2_0/Mono.Cecil.dll
17
18 LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS) \
19         /r:$(topdir)/class/lib/net_2_0/monodoc.dll
20 PROGRAM = mdoc.exe
21 PROGRAM_DEPS = $(topdir)/class/lib/net_2_0/monodoc.dll
22
23 ifdef NET
24 all : copy-with-deps
25
26 copy-with-deps:
27         -mkdir mdoc-net
28         cp $(PROGRAM) mdoc-net
29         cp $(topdir)/class/lib/net_2_0/Commons.Xml.Relaxng.dll mdoc-net
30         cp $(topdir)/class/lib/net_2_0/ICSharpCode.SharpZipLib.dll mdoc-net
31         cp $(topdir)/class/lib/net_2_0/Mono.Cecil.dll mdoc-net
32         cp $(topdir)/class/lib/net_2_0/monodoc.dll mdoc-net
33 endif
34
35 MONODOC_RESOURCES = \
36         ../monodoc/Resources/mdoc-html-utils.xsl    \
37         ../monodoc/Resources/mdoc-sections-css.xsl  \
38         ../monodoc/Resources/mono-ecma-css.xsl
39
40 MDOC_RESOURCES = \
41         Resources/defaulttemplate.xsl     \
42         Resources/monodoc-ecma.xsd        \
43         Resources/overview.xsl            \
44         Resources/stylesheet.xsl
45
46 MDOC_TEST_FILES = \
47         Test/DocTest-v1.cs                                        \
48         Test/DocTest-v2.patch                                     \
49         Test/msxdoc-expected.importslashdoc.xml                   \
50         Test/TestEcmaDocs.xml                                     \
51         Test/validate.check.monodocer                             \
52         Test/validate.check.monodocer.importslashdoc              \
53         Test/validate.check.monodocer.since
54
55 EXTRA_DISTFILES = \
56         $(MDOC_RESOURCES) \
57         $(MDOC_TEST_FILES)
58
59 $(PROGRAM) : $(MDOC_RESOURCES) $(MONODOC_RESOURCES) $(PROGRAM_DEPS)
60
61 include ../../build/executable.make
62
63 $(PROGRAM) : Makefile
64
65 MONO = \
66         MONO_PATH="$(topdir)/class/lib/2.0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
67         $(RUNTIME) $(RUNTIME_FLAGS)
68
69 dist-local: dist-default dist-tests
70
71 dist-tests:
72         find Test/en.expected* -name '*.xml'     > .files
73         find Test/html.expected* -name '*.html' >> .files
74         tar cTf .files - | (cd $(distdir); tar xf -)
75         rm .files ; \
76
77 test-local: $(PROGRAM)
78
79 clean-local: cleanup
80
81 cleanup:
82         -rm -Rf Test/en.actual Test/html.actual
83         -rm -f monodocer1.exe*
84
85 Test/DocTest.dll: 
86         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest.cs
87
88 Test/DocTest.dll-v1: 
89         -rm -f Test/DocTest.cs
90         cp Test/DocTest-v1.cs Test/DocTest.cs
91         -rm -f Test/DocTest.dll
92         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
93
94 Test/DocTest.dll-v2: 
95         -rm -f Test/DocTest.cs
96         cp Test/DocTest-v1.cs Test/DocTest.cs
97         cd Test && patch -p0 < DocTest-v2.patch
98         -rm -f Test/DocTest.dll
99         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
100
101 check-monodocer-update: $(PROGRAM)
102         find Test/en.expected -name \*.xml -exec rm "{}" \;
103         $(MAKE) Test/DocTest.dll-v1
104         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected Test/DocTest.dll
105
106 check-monodocer: $(PROGRAM)
107         -rm -Rf Test/en.actual
108         $(MAKE) Test/DocTest.dll-v1
109         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest.dll
110         diff --exclude=.svn -rup Test/en.expected Test/en.actual
111         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest.dll 
112         diff --exclude=.svn -rup Test/en.expected Test/en.actual
113
114 check-monodocer-since-update: $(PROGRAM)
115         find Test/en.expected.since -name \*.xml -exec rm "{}" \;
116         $(MAKE) Test/DocTest.dll-v1
117         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.since Test/DocTest.dll 
118         $(MAKE) Test/DocTest.dll-v2
119         $(MONO) $(PROGRAM) update --exceptions=all --since="Version 2.0" \
120                 -o Test/en.expected.since Test/DocTest.dll 
121
122 check-monodocer-since: $(PROGRAM)
123         rm -Rf Test/en.actual
124         $(MAKE) Test/DocTest.dll-v1
125         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest.dll 
126         $(MAKE) Test/DocTest.dll-v2
127         $(MONO) $(PROGRAM) update --exceptions=all --since="Version 2.0" \
128                 -o Test/en.actual Test/DocTest.dll 
129         diff --exclude=.svn -rup Test/en.expected.since Test/en.actual
130
131 check-monodocer-importslashdoc-update: $(PROGRAM)
132         find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
133         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
134         $(MONO) $(PROGRAM) update --exceptions=all -i Test/DocTest.xml \
135                 -o Test/en.expected.importslashdoc Test/DocTest.dll 
136
137 check-monodocer-importslashdoc: $(PROGRAM)
138         rm -Rf Test/en.actual
139         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
140         $(MONO) $(PROGRAM) update --exceptions=all -i Test/DocTest.xml \
141                 -o Test/en.actual Test/DocTest.dll 
142         diff --exclude=.svn -rup Test/en.expected.importslashdoc Test/en.actual
143
144 check-monodocer-importecmadoc-update: $(PROGRAM)
145         find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
146         $(MAKE) Test/DocTest.dll-v1
147         $(MONO) $(PROGRAM) update --exceptions=all -i Test/TestEcmaDocs.xml \
148                 '--type=System.Action`1' --type=System.AsyncCallback \
149                 --type=System.Environment --type=System.Array \
150                 -o Test/en.expected.importecmadoc Test/DocTest.dll 
151
152 check-monodocer-importecmadoc: $(PROGRAM)
153         rm -Rf Test/en.actual
154         $(MAKE) Test/DocTest.dll-v1
155         $(MONO) $(PROGRAM) update --exceptions=all -i Test/TestEcmaDocs.xml \
156                 '--type=System.Action`1' --type=System.AsyncCallback \
157                 --type=System.Environment --type=System.Array \
158                 -o Test/en.actual Test/DocTest.dll 
159         diff --exclude=.svn -rup Test/en.expected.importecmadoc Test/en.actual
160
161 check-mdoc-export-html-update: $(PROGRAM)
162         find Test/html.expected -name \*.html -exec rm "{}" \;
163         $(MONO) $(PROGRAM) export-html -o Test/html.expected \
164                 Test/en.expected.importslashdoc 
165
166 check-mdoc-export-html: check-monodocer $(PROGRAM)
167         rm -Rf Test/html.actual
168         $(MONO) $(PROGRAM) export-html -o Test/html.actual \
169                 Test/en.expected.importslashdoc
170         diff --exclude=.svn -rup Test/html.expected Test/html.actual
171
172 check-mdoc-export-html-with-version: $(PROGRAM)
173         rm -Rf Test/html.actual.v0 Test/html.actual.since-with-v0 .v0.txt .v2.txt
174         $(MONO) $(PROGRAM) export-html -o Test/html.actual.v0 \
175                 Test/en.expected
176         $(MONO) $(PROGRAM) export-html -o Test/html.actual.since-with-v0 \
177                 Test/en.expected.since -with-version 0.0.0.0
178         (cd Test/html.actual.v0            && find . -type f) | sort > .v0.txt
179         (cd Test/html.actual.since-with-v0 && find . -type f) | sort > .v2.txt
180         diff -rup .v0.txt .v2.txt   # assert no types added
181
182 check-md-html-dir: $(PROGRAM)
183         rm -Rf Test/html.actual
184         $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
185         diff --exclude=.svn -rup Test/html.expected Test/html.actual
186
187 check-mdoc-export-msxdoc-update:
188         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
189                 > Test/msxdoc-expected.importslashdoc.xml
190
191 check-mdoc-export-msxdoc:
192         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
193                 | diff --brief - Test/msxdoc-expected.importslashdoc.xml
194
195 my_abs_top_srcdir = $(shell cd . && pwd)
196
197 check-mdoc-validate-update: $(PROGRAM)
198         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
199                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
200                 Test/validate.check.monodocer
201         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
202                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
203                 Test/validate.check.monodocer.importslashdoc
204         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
205                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
206                 Test/validate.check.monodocer.since
207
208 check-mdoc-validate: $(PROGRAM)
209         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
210                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
211                 diff - Test/validate.check.monodocer
212         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
213                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
214                 diff --brief - Test/validate.check.monodocer.importslashdoc
215         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
216                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
217                 diff --brief - Test/validate.check.monodocer.since
218
219 run-test-local: check-doc-tools
220
221 run-test-update : check-doc-tools-update
222
223 check-doc-tools: check-monodocer-since \
224         check-monodocer-importecmadoc \
225         check-monodocer-importslashdoc \
226         check-monodocer \
227         check-mdoc-export-html \
228         check-mdoc-export-html-with-version \
229         check-mdoc-export-msxdoc \
230         check-mdoc-validate
231
232 check-doc-tools-update: check-monodocer-since-update \
233         check-monodocer-importecmadoc-update \
234         check-monodocer-importslashdoc-update \
235         check-monodocer-update \
236         check-mdoc-export-html-update \
237         check-mdoc-export-msxdoc-update \
238         check-mdoc-validate-update
239