Merge pull request #1624 from esdrubal/getprocesstimes
[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/CLILibraryTypes.dtd                                  \
51         Test/DocTest-v1.cs                                        \
52         Test/DocTest-v2.patch                                     \
53         Test/msxdoc-expected.importslashdoc.xml                   \
54         Test/TestEcmaDocs.xml                                     \
55         Test/validate.check.monodocer                             \
56         Test/validate.check.monodocer.importslashdoc              \
57         Test/validate.check.monodocer.since
58
59 EXTRA_DISTFILES = \
60         $(MDOC_RESOURCES) \
61         $(MDOC_TEST_FILES)
62
63 $(PROGRAM) : $(MDOC_RESOURCES) $(MONODOC_RESOURCES) $(PROGRAM_DEPS)
64
65 PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
66
67 include ../../build/executable.make
68
69 $(PROGRAM) : $(build_lib)
70         cp $< $@
71
72 $(PROGRAM) : Makefile
73
74 MONO = \
75         MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
76         $(RUNTIME) $(RUNTIME_FLAGS)
77
78 dist-local: dist-default dist-tests
79
80 dist-tests:
81         find Test/en.expected* -name '*.xml'     > .files
82         find Test/html.expected* -name '*.html' >> .files
83         tar cTf .files - | (cd $(distdir); tar xf -)
84         rm .files ; \
85
86 test-local: $(PROGRAM)
87
88 clean-local: cleanup
89
90 cleanup:
91         -rm -Rf Test/en.actual Test/html.actual
92         -rm -f monodocer1.exe*
93
94 Test/DocTest-addNonGeneric.dll:
95         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-addNonGeneric.cs
96
97 Test/DocTest-addNonGeneric-v2.dll:
98         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-addNonGeneric.cs /define:V2
99
100 Test/DocTest-DropNS-classic-secondary.dll:
101         @echo $(value @)
102         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic-secondary.cs
103
104 Test/DocTest-DropNS-classic.dll:
105         @echo $(value @)
106         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs
107
108 Test/DocTest-DropNS-unified.dll:
109         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs
110
111 Test/DocTest.dll: 
112         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest.cs
113
114 Test/DocTest-InternalInterface.dll: 
115         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-InternalInterface.cs
116
117 Test/DocTest.dll-v1: 
118         -rm -f Test/DocTest.cs
119         cp Test/DocTest-v1.cs Test/DocTest.cs
120         -rm -f Test/DocTest.dll
121         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
122
123 Test/DocTest.dll-v2: 
124         -rm -f Test/DocTest.cs
125         cp Test/DocTest-v1.cs Test/DocTest.cs
126         cd Test && patch -p0 < DocTest-v2.patch
127         -rm -f Test/DocTest.dll
128         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
129
130 check-monodocer-addNonGeneric: $(PROGRAM)
131         -rm -Rf Test/en.actual
132         # first, make a docset with the generic method
133         $(MAKE) Test/DocTest-addNonGeneric.dll
134         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric.dll
135
136         # now add a non-generic version of the method and update several times
137         $(MAKE) Test/DocTest-addNonGeneric-v2.dll
138         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
139         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
140         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
141         diff --exclude=.svn -rup Test/en.expected-addNonGeneric Test/en.actual
142
143 check-monodocer-dropns-classic: $(PROGRAM)
144         # tests the simplest --dropns case, a single class where the root namespace was dropped.
145         -rm -Rf Test/en.actual
146         $(MAKE) Test/DocTest-DropNS-classic.dll
147         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll
148         $(MAKE) update-monodocer-dropns-unified
149         diff --exclude=.svn -rup Test/en.expected-dropns-classic-v1 Test/en.actual
150
151 check-monodocer-dropns-classic-withsecondary: $(PROGRAM)
152         # tests case where a secondary assembly is included with a --dropns parameter
153         -rm -Rf Test/en.actual
154         $(MAKE) Test/DocTest-DropNS-classic.dll
155         $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
156         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-secondary.dll
157         $(MAKE) update-monodocer-dropns-unified-withsecondary
158         diff --exclude=.svn -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
159
160 update-monodocer-dropns-unified: $(PROGRAM)
161         $(MAKE) Test/DocTest-DropNS-unified.dll
162         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll --dropns Test/DocTest-DropNS-unified.dll=MyFramework
163
164 update-monodocer-dropns-unified-withsecondary: $(PROGRAM)
165         $(MAKE) Test/DocTest-DropNS-unified.dll
166         $(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
167
168 update-monodocer-dropns-classic-secondary: $(PROGRAM)
169         $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
170         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic-secondary.dll
171
172 check-monodocer-internal-interface: $(PROGRAM)
173         # Tests to make sure internal interfaces that are explicitly implemented are not documented
174         -rm -Rf Test/en.actual
175         $(MAKE) Test/DocTest-InternalInterface.dll
176         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-InternalInterface.dll
177         diff --exclude=.svn -rup Test/en.expected-internal-interface Test/en.actual
178
179 check-monodocer-update: $(PROGRAM)
180         find Test/en.expected -name \*.xml -exec rm "{}" \;
181         $(MAKE) Test/DocTest.dll-v1
182         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected Test/DocTest.dll
183
184 check-monodocer: $(PROGRAM)
185         -rm -Rf Test/en.actual
186         $(MAKE) Test/DocTest.dll-v1
187         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll
188         diff --exclude=.svn -rup Test/en.expected Test/en.actual
189         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll 
190         diff --exclude=.svn -rup Test/en.expected Test/en.actual
191
192 check-monodocer-since-update: $(PROGRAM)
193         find Test/en.expected.since -name \*.xml -exec rm "{}" \;
194         $(MAKE) Test/DocTest.dll-v1
195         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.since Test/DocTest.dll 
196         $(MAKE) Test/DocTest.dll-v2
197         $(MONO) $(PROGRAM) update --exceptions=all --since="Version 2.0" \
198                 -o Test/en.expected.since Test/DocTest.dll 
199
200 check-monodocer-since: $(PROGRAM)
201         rm -Rf Test/en.actual
202         $(MAKE) Test/DocTest.dll-v1
203         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll 
204         $(MAKE) Test/DocTest.dll-v2
205         $(MONO) $(PROGRAM) --debug update --exceptions=all --since="Version 2.0" \
206                 -o Test/en.actual Test/DocTest.dll 
207         diff --exclude=.svn -rup Test/en.expected.since Test/en.actual
208
209 check-monodocer-delete-update: $(PROGRAM)
210         find Test/en.expected.delete -type f -exec rm "{}" \;
211         $(MAKE) Test/DocTest.dll-v1
212         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
213         $(MAKE) Test/DocTest.dll-v2
214         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
215         $(MAKE) Test/DocTest.dll-v1
216         $(MONO) $(PROGRAM) update -fno-assembly-versions --delete --exceptions=all \
217                 -o Test/en.expected.delete Test/DocTest.dll
218
219 check-monodocer-delete: $(PROGRAM)
220         rm -Rf Test/en.actual
221         $(MAKE) Test/DocTest.dll-v1
222         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
223         $(MAKE) Test/DocTest.dll-v2
224         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
225         $(MAKE) Test/DocTest.dll-v1
226         $(MONO) $(PROGRAM) --debug update -fno-assembly-versions --delete --exceptions=all -o Test/en.actual Test/DocTest.dll
227         diff --exclude=.svn -rup Test/en.expected.delete Test/en.actual
228
229 check-monodocer-importslashdoc-update: $(PROGRAM)
230         find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
231         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
232         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
233                 -o Test/en.expected.importslashdoc Test/DocTest.dll 
234
235 check-monodocer-importslashdoc: $(PROGRAM)
236         rm -Rf Test/en.actual
237         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
238         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
239                 -o Test/en.actual Test/DocTest.dll 
240         diff --exclude=.svn -rup Test/en.expected.importslashdoc Test/en.actual
241
242 check-monodocer-importecmadoc-update: $(PROGRAM)
243         find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
244         $(MAKE) Test/DocTest.dll-v1
245         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
246                 '--type=System.Action`1' --type=System.AsyncCallback \
247                 --type=System.Environment --type=System.Array \
248                 -o Test/en.expected.importecmadoc Test/DocTest.dll 
249
250 check-monodocer-importecmadoc: $(PROGRAM)
251         rm -Rf Test/en.actual
252         $(MAKE) Test/DocTest.dll-v1
253         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
254                 '--type=System.Action`1' --type=System.AsyncCallback \
255                 --type=System.Environment --type=System.Array \
256                 -o Test/en.actual Test/DocTest.dll 
257         diff --exclude=.svn -rup Test/en.expected.importecmadoc Test/en.actual
258
259 check-mdoc-export-html-update: $(PROGRAM)
260         find Test/html.expected -name \*.html -exec rm "{}" \;
261         $(MONO) $(PROGRAM) export-html -o Test/html.expected \
262                 Test/en.expected.importslashdoc 
263
264 check-mdoc-export-html: check-monodocer $(PROGRAM)
265         rm -Rf Test/html.actual
266         $(MONO) $(PROGRAM) export-html -o Test/html.actual \
267                 Test/en.expected.importslashdoc
268         diff --exclude=.svn -rup Test/html.expected Test/html.actual
269
270 check-mdoc-export-html-with-version: $(PROGRAM)
271         rm -Rf Test/html.actual.v0 Test/html.actual.since-with-v0 .v0.txt .v2.txt
272         $(MONO) $(PROGRAM) export-html -o Test/html.actual.v0 \
273                 Test/en.expected
274         $(MONO) $(PROGRAM) export-html -o Test/html.actual.since-with-v0 \
275                 Test/en.expected.since -with-version 0.0.0.0
276         (cd Test/html.actual.v0            && find . -type f) | sort > .v0.txt
277         (cd Test/html.actual.since-with-v0 && find . -type f) | sort > .v2.txt
278         diff -rup .v0.txt .v2.txt   # assert no types added
279
280 check-md-html-dir: $(PROGRAM)
281         rm -Rf Test/html.actual
282         $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
283         diff --exclude=.svn -rup Test/html.expected Test/html.actual
284
285 check-mdoc-export-msxdoc-update:
286         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
287                 > Test/msxdoc-expected.importslashdoc.xml
288
289 check-mdoc-export-msxdoc:
290         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
291                 | diff --brief - Test/msxdoc-expected.importslashdoc.xml
292
293 my_abs_top_srcdir = $(shell cd . && pwd)
294
295 check-mdoc-validate-update: $(PROGRAM)
296         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
297                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
298                 Test/validate.check.monodocer
299         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
300                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
301                 Test/validate.check.monodocer.importslashdoc
302         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
303                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
304                 Test/validate.check.monodocer.since
305
306 check-mdoc-validate: $(PROGRAM)
307         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
308                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
309                 diff - Test/validate.check.monodocer
310         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
311                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
312                 diff --brief - Test/validate.check.monodocer.importslashdoc
313         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
314                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
315                 diff --brief - Test/validate.check.monodocer.since
316
317 run-test-local: check-doc-tools
318
319 run-test-update : check-doc-tools-update
320
321 check-doc-tools: check-monodocer-since \
322         check-monodocer-importecmadoc \
323         check-monodocer-importslashdoc \
324         check-monodocer \
325         check-monodocer-delete \
326         check-mdoc-export-html \
327         check-mdoc-export-html-with-version \
328         check-mdoc-export-msxdoc \
329         check-mdoc-validate
330
331 check-doc-tools-update: check-monodocer-since-update \
332         check-monodocer-importecmadoc-update \
333         check-monodocer-importslashdoc-update \
334         check-monodocer-update \
335         check-monodocer-dropns-classic \
336         check-monodocer-dropns-classic-withsecondary \
337         check-monodocer-internal-interface \
338         check-monodocer-delete-update \
339         check-mdoc-export-html-update \
340         check-mdoc-export-msxdoc-update \
341         check-mdoc-validate-update 
342
343 check: check-doc-tools \
344         check-doc-tools-update
345