Merge pull request #1185 from esdrubal/http-reuse
[mono.git] / mcs / tools / mdoc / Makefile
1 thisdir = tools/mdoc
2 SUBDIRS = 
3 include ../../build/rules.make
4
5 MDOC_COMMON_FLAGS = \
6         /resource:../../class/monodoc/Resources/mdoc-html-format.xsl,mdoc-html-format.xsl    \
7         /resource:../../class/monodoc/Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl      \
8         /resource:../../class/monodoc/Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl  \
9         /resource:../../class/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/msitomsx.xsl,msitomsx.xsl                               \
13         /resource:Resources/overview.xsl,overview.xsl                               \
14         /resource:Resources/stylesheet.xsl,stylesheet.xsl                           \
15         /r:System.Web.dll                                                           \
16         /r:System.Xml.Linq.dll                                                      \
17         /r:ICSharpCode.SharpZipLib.dll                                              \
18         /r:Mono.Cecil.dll
19
20 LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS) \
21         /r:monodoc.dll
22 PROGRAM = mdoc.exe
23 PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll
24
25 ifdef NET
26 all : copy-with-deps
27
28 copy-with-deps:
29         -mkdir mdoc-net
30         cp $(PROGRAM) mdoc-net
31         cp $(topdir)/class/lib/$(PROFILE)/Commons.Xml.Relaxng.dll mdoc-net
32         cp $(topdir)/class/lib/$(PROFILE)/ICSharpCode.SharpZipLib.dll mdoc-net
33         cp $(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll mdoc-net
34         cp $(topdir)/class/lib/$(PROFILE)/monodoc.dll mdoc-net
35 endif
36
37 MONODOC_RESOURCES = \
38         ../../class/monodoc/Resources/mdoc-html-utils.xsl    \
39         ../../class/monodoc/Resources/mdoc-sections-css.xsl  \
40         ../../class/monodoc/Resources/mono-ecma-css.xsl
41
42 MDOC_RESOURCES = \
43         Resources/defaulttemplate.xsl     \
44         Resources/monodoc-ecma.xsd        \
45         Resources/msitomsx.xsl            \
46         Resources/overview.xsl            \
47         Resources/stylesheet.xsl
48
49 MDOC_TEST_FILES = \
50         Test/DocTest-v1.cs                                        \
51         Test/DocTest-v2.patch                                     \
52         Test/msxdoc-expected.importslashdoc.xml                   \
53         Test/TestEcmaDocs.xml                                     \
54         Test/validate.check.monodocer                             \
55         Test/validate.check.monodocer.importslashdoc              \
56         Test/validate.check.monodocer.since
57
58 EXTRA_DISTFILES = \
59         $(MDOC_RESOURCES) \
60         $(MDOC_TEST_FILES)
61
62 $(PROGRAM) : $(MDOC_RESOURCES) $(MONODOC_RESOURCES) $(PROGRAM_DEPS)
63
64 PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
65
66 include ../../build/executable.make
67
68 $(PROGRAM) : $(build_lib)
69         cp $< $@
70
71 $(PROGRAM) : Makefile
72
73 MONO = \
74         MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
75         $(RUNTIME) $(RUNTIME_FLAGS)
76
77 dist-local: dist-default dist-tests
78
79 dist-tests:
80         find Test/en.expected* -name '*.xml'     > .files
81         find Test/html.expected* -name '*.html' >> .files
82         tar cTf .files - | (cd $(distdir); tar xf -)
83         rm .files ; \
84
85 test-local: $(PROGRAM)
86
87 clean-local: cleanup
88
89 cleanup:
90         -rm -Rf Test/en.actual Test/html.actual
91         -rm -f monodocer1.exe*
92
93 Test/DocTest-DropNS-classic-secondary.dll:
94         @echo $(value @)
95         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic-secondary.cs
96
97 Test/DocTest-DropNS-classic.dll:
98         @echo $(value @)
99         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs
100
101 Test/DocTest-DropNS-unified.dll:
102         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs
103
104 Test/DocTest.dll: 
105         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest.cs
106
107 Test/DocTest-InternalInterface.dll: 
108         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-InternalInterface.cs
109
110 Test/DocTest.dll-v1: 
111         -rm -f Test/DocTest.cs
112         cp Test/DocTest-v1.cs Test/DocTest.cs
113         -rm -f Test/DocTest.dll
114         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
115
116 Test/DocTest.dll-v2: 
117         -rm -f Test/DocTest.cs
118         cp Test/DocTest-v1.cs Test/DocTest.cs
119         cd Test && patch -p0 < DocTest-v2.patch
120         -rm -f Test/DocTest.dll
121         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
122
123 check-monodocer-dropns-classic: $(PROGRAM)
124         # tests the simplest --dropns case, a single class where the root namespace was dropped.
125         -rm -Rf Test/en.actual
126         $(MAKE) Test/DocTest-DropNS-classic.dll
127         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll
128         $(MAKE) update-monodocer-dropns-unified
129         diff --exclude=.svn -rup Test/en.expected-dropns-classic-v1 Test/en.actual
130
131 check-monodocer-dropns-classic-withsecondary: $(PROGRAM)
132         # tests case where a secondary assembly is included with a --dropns parameter
133         -rm -Rf Test/en.actual
134         $(MAKE) Test/DocTest-DropNS-classic.dll
135         $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
136         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-secondary.dll
137         $(MAKE) update-monodocer-dropns-unified-withsecondary
138         diff --exclude=.svn -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
139
140 update-monodocer-dropns-unified: $(PROGRAM)
141         $(MAKE) Test/DocTest-DropNS-unified.dll
142         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll --dropns Test/DocTest-DropNS-unified.dll=MyFramework
143
144 update-monodocer-dropns-unified-withsecondary: $(PROGRAM)
145         $(MAKE) Test/DocTest-DropNS-unified.dll
146         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll Test/DocTest-DropNS-classic-secondary.dll --dropns Test/DocTest-DropNS-unified.dll=MyFramework
147
148 update-monodocer-dropns-classic-secondary: $(PROGRAM)
149         $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
150         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic-secondary.dll
151
152 check-monodocer-internal-interface: $(PROGRAM)
153         # Tests to make sure internal interfaces that are explicitly implemented are not documented
154         -rm -Rf Test/en.actual
155         $(MAKE) Test/DocTest-InternalInterface.dll
156         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-InternalInterface.dll
157         diff --exclude=.svn -rup Test/en.expected-internal-interface Test/en.actual
158
159 check-monodocer-update: $(PROGRAM)
160         find Test/en.expected -name \*.xml -exec rm "{}" \;
161         $(MAKE) Test/DocTest.dll-v1
162         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected Test/DocTest.dll
163
164 check-monodocer: $(PROGRAM)
165         -rm -Rf Test/en.actual
166         $(MAKE) Test/DocTest.dll-v1
167         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll
168         diff --exclude=.svn -rup Test/en.expected Test/en.actual
169         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll 
170         diff --exclude=.svn -rup Test/en.expected Test/en.actual
171
172 check-monodocer-since-update: $(PROGRAM)
173         find Test/en.expected.since -name \*.xml -exec rm "{}" \;
174         $(MAKE) Test/DocTest.dll-v1
175         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.since Test/DocTest.dll 
176         $(MAKE) Test/DocTest.dll-v2
177         $(MONO) $(PROGRAM) update --exceptions=all --since="Version 2.0" \
178                 -o Test/en.expected.since Test/DocTest.dll 
179
180 check-monodocer-since: $(PROGRAM)
181         rm -Rf Test/en.actual
182         $(MAKE) Test/DocTest.dll-v1
183         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll 
184         $(MAKE) Test/DocTest.dll-v2
185         $(MONO) $(PROGRAM) --debug update --exceptions=all --since="Version 2.0" \
186                 -o Test/en.actual Test/DocTest.dll 
187         diff --exclude=.svn -rup Test/en.expected.since Test/en.actual
188
189 check-monodocer-delete-update: $(PROGRAM)
190         find Test/en.expected.delete -type f -exec rm "{}" \;
191         $(MAKE) Test/DocTest.dll-v1
192         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
193         $(MAKE) Test/DocTest.dll-v2
194         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
195         $(MAKE) Test/DocTest.dll-v1
196         $(MONO) $(PROGRAM) update -fno-assembly-versions --delete --exceptions=all \
197                 -o Test/en.expected.delete Test/DocTest.dll
198
199 check-monodocer-delete: $(PROGRAM)
200         rm -Rf Test/en.actual
201         $(MAKE) Test/DocTest.dll-v1
202         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
203         $(MAKE) Test/DocTest.dll-v2
204         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
205         $(MAKE) Test/DocTest.dll-v1
206         $(MONO) $(PROGRAM) --debug update -fno-assembly-versions --delete --exceptions=all -o Test/en.actual Test/DocTest.dll
207         diff --exclude=.svn -rup Test/en.expected.delete Test/en.actual
208
209 check-monodocer-importslashdoc-update: $(PROGRAM)
210         find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
211         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
212         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
213                 -o Test/en.expected.importslashdoc Test/DocTest.dll 
214
215 check-monodocer-importslashdoc: $(PROGRAM)
216         rm -Rf Test/en.actual
217         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
218         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
219                 -o Test/en.actual Test/DocTest.dll 
220         diff --exclude=.svn -rup Test/en.expected.importslashdoc Test/en.actual
221
222 check-monodocer-importecmadoc-update: $(PROGRAM)
223         find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
224         $(MAKE) Test/DocTest.dll-v1
225         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
226                 '--type=System.Action`1' --type=System.AsyncCallback \
227                 --type=System.Environment --type=System.Array \
228                 -o Test/en.expected.importecmadoc Test/DocTest.dll 
229
230 check-monodocer-importecmadoc: $(PROGRAM)
231         rm -Rf Test/en.actual
232         $(MAKE) Test/DocTest.dll-v1
233         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
234                 '--type=System.Action`1' --type=System.AsyncCallback \
235                 --type=System.Environment --type=System.Array \
236                 -o Test/en.actual Test/DocTest.dll 
237         diff --exclude=.svn -rup Test/en.expected.importecmadoc Test/en.actual
238
239 check-mdoc-export-html-update: $(PROGRAM)
240         find Test/html.expected -name \*.html -exec rm "{}" \;
241         $(MONO) $(PROGRAM) export-html -o Test/html.expected \
242                 Test/en.expected.importslashdoc 
243
244 check-mdoc-export-html: check-monodocer $(PROGRAM)
245         rm -Rf Test/html.actual
246         $(MONO) $(PROGRAM) export-html -o Test/html.actual \
247                 Test/en.expected.importslashdoc
248         diff --exclude=.svn -rup Test/html.expected Test/html.actual
249
250 check-mdoc-export-html-with-version: $(PROGRAM)
251         rm -Rf Test/html.actual.v0 Test/html.actual.since-with-v0 .v0.txt .v2.txt
252         $(MONO) $(PROGRAM) export-html -o Test/html.actual.v0 \
253                 Test/en.expected
254         $(MONO) $(PROGRAM) export-html -o Test/html.actual.since-with-v0 \
255                 Test/en.expected.since -with-version 0.0.0.0
256         (cd Test/html.actual.v0            && find . -type f) | sort > .v0.txt
257         (cd Test/html.actual.since-with-v0 && find . -type f) | sort > .v2.txt
258         diff -rup .v0.txt .v2.txt   # assert no types added
259
260 check-md-html-dir: $(PROGRAM)
261         rm -Rf Test/html.actual
262         $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
263         diff --exclude=.svn -rup Test/html.expected Test/html.actual
264
265 check-mdoc-export-msxdoc-update:
266         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
267                 > Test/msxdoc-expected.importslashdoc.xml
268
269 check-mdoc-export-msxdoc:
270         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
271                 | diff --brief - Test/msxdoc-expected.importslashdoc.xml
272
273 my_abs_top_srcdir = $(shell cd . && pwd)
274
275 check-mdoc-validate-update: $(PROGRAM)
276         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
277                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
278                 Test/validate.check.monodocer
279         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
280                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
281                 Test/validate.check.monodocer.importslashdoc
282         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
283                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
284                 Test/validate.check.monodocer.since
285
286 check-mdoc-validate: $(PROGRAM)
287         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
288                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
289                 diff - Test/validate.check.monodocer
290         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
291                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
292                 diff --brief - Test/validate.check.monodocer.importslashdoc
293         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
294                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
295                 diff --brief - Test/validate.check.monodocer.since
296
297 run-test-local: check-doc-tools
298
299 run-test-update : check-doc-tools-update
300
301 check-doc-tools: check-monodocer-since \
302         check-monodocer-importecmadoc \
303         check-monodocer-importslashdoc \
304         check-monodocer \
305         check-monodocer-delete \
306         check-mdoc-export-html \
307         check-mdoc-export-html-with-version \
308         check-mdoc-export-msxdoc \
309         check-mdoc-validate
310
311 check-doc-tools-update: check-monodocer-since-update \
312         check-monodocer-importecmadoc-update \
313         check-monodocer-importslashdoc-update \
314         check-monodocer-update \
315         check-monodocer-dropns-classic \
316         check-monodocer-dropns-classic-withsecondary \
317         check-monodocer-internal-interface \
318         check-monodocer-delete-update \
319         check-mdoc-export-html-update \
320         check-mdoc-export-msxdoc-update \
321         check-mdoc-validate-update 
322
323