Merge pull request #1870 from saper/langinfo_h
[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 Test/DocTest-enumerations.dll: 
131         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-enumerations.cs
132
133 check-monodocer-addNonGeneric: $(PROGRAM)
134         -rm -Rf Test/en.actual
135         # first, make a docset with the generic method
136         $(MAKE) Test/DocTest-addNonGeneric.dll
137         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric.dll
138
139         # now add a non-generic version of the method and update several times
140         $(MAKE) Test/DocTest-addNonGeneric-v2.dll
141         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
142         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
143         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
144         diff --exclude=.svn -rup Test/en.expected-addNonGeneric Test/en.actual
145
146 check-monodocer-dropns-classic: $(PROGRAM)
147         # tests the simplest --dropns case, a single class where the root namespace was dropped.
148         -rm -Rf Test/en.actual
149         $(MAKE) Test/DocTest-DropNS-classic.dll
150         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll
151         $(MAKE) update-monodocer-dropns-unified
152         diff --exclude=.svn -rup Test/en.expected-dropns-classic-v1 Test/en.actual
153
154 check-monodocer-dropns-classic-withsecondary: $(PROGRAM)
155         # tests case where a secondary assembly is included with a --dropns parameter
156         -rm -Rf Test/en.actual
157         $(MAKE) Test/DocTest-DropNS-classic.dll
158         $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
159         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-secondary.dll
160         $(MAKE) update-monodocer-dropns-unified-withsecondary
161         diff --exclude=.svn -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
162
163 update-monodocer-dropns-unified: $(PROGRAM)
164         $(MAKE) Test/DocTest-DropNS-unified.dll
165         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll --dropns Test/DocTest-DropNS-unified.dll=MyFramework
166
167 update-monodocer-dropns-unified-withsecondary: $(PROGRAM)
168         $(MAKE) Test/DocTest-DropNS-unified.dll
169         $(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
170
171 update-monodocer-dropns-classic-secondary: $(PROGRAM)
172         $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
173         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic-secondary.dll
174
175 check-monodocer-internal-interface: $(PROGRAM)
176         # Tests to make sure internal interfaces that are explicitly implemented are not documented
177         -rm -Rf Test/en.actual
178         $(MAKE) Test/DocTest-InternalInterface.dll
179         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-InternalInterface.dll
180         diff --exclude=.svn -rup Test/en.expected-internal-interface Test/en.actual
181
182 check-monodocer-enumerations: $(PROGRAM)
183         -rm -Rf Test/en.actual
184         $(MAKE) Test/DocTest-enumerations.dll
185         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-enumerations.dll
186         diff --exclude=.svn -rup Test/en.expected-enumerations Test/en.actual
187
188 check-monodocer-update: $(PROGRAM)
189         find Test/en.expected -name \*.xml -exec rm "{}" \;
190         $(MAKE) Test/DocTest.dll-v1
191         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected Test/DocTest.dll
192
193 check-monodocer: $(PROGRAM)
194         -rm -Rf Test/en.actual
195         $(MAKE) Test/DocTest.dll-v1
196         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll
197         diff --exclude=.svn -rup Test/en.expected Test/en.actual
198         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll 
199         diff --exclude=.svn -rup Test/en.expected Test/en.actual
200
201 check-monodocer-since-update: $(PROGRAM)
202         find Test/en.expected.since -name \*.xml -exec rm "{}" \;
203         $(MAKE) Test/DocTest.dll-v1
204         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.since Test/DocTest.dll 
205         $(MAKE) Test/DocTest.dll-v2
206         $(MONO) $(PROGRAM) update --exceptions=all --since="Version 2.0" \
207                 -o Test/en.expected.since Test/DocTest.dll 
208
209 check-monodocer-since: $(PROGRAM)
210         rm -Rf Test/en.actual
211         $(MAKE) Test/DocTest.dll-v1
212         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll 
213         $(MAKE) Test/DocTest.dll-v2
214         $(MONO) $(PROGRAM) --debug update --exceptions=all --since="Version 2.0" \
215                 -o Test/en.actual Test/DocTest.dll 
216         diff --exclude=.svn -rup Test/en.expected.since Test/en.actual
217
218 check-monodocer-delete-update: $(PROGRAM)
219         find Test/en.expected.delete -type f -exec rm "{}" \;
220         $(MAKE) Test/DocTest.dll-v1
221         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
222         $(MAKE) Test/DocTest.dll-v2
223         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
224         $(MAKE) Test/DocTest.dll-v1
225         $(MONO) $(PROGRAM) update -fno-assembly-versions --delete --exceptions=all \
226                 -o Test/en.expected.delete Test/DocTest.dll
227
228 check-monodocer-delete: $(PROGRAM)
229         rm -Rf Test/en.actual
230         $(MAKE) Test/DocTest.dll-v1
231         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
232         $(MAKE) Test/DocTest.dll-v2
233         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
234         $(MAKE) Test/DocTest.dll-v1
235         $(MONO) $(PROGRAM) --debug update -fno-assembly-versions --delete --exceptions=all -o Test/en.actual Test/DocTest.dll
236         diff --exclude=.svn -rup Test/en.expected.delete Test/en.actual
237
238 check-monodocer-importslashdoc-update: $(PROGRAM)
239         find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
240         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
241         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
242                 -o Test/en.expected.importslashdoc Test/DocTest.dll 
243
244 check-monodocer-importslashdoc: $(PROGRAM)
245         rm -Rf Test/en.actual
246         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
247         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
248                 -o Test/en.actual Test/DocTest.dll 
249         diff --exclude=.svn -rup Test/en.expected.importslashdoc Test/en.actual
250
251 check-monodocer-importecmadoc-update: $(PROGRAM)
252         find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
253         $(MAKE) Test/DocTest.dll-v1
254         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
255                 '--type=System.Action`1' --type=System.AsyncCallback \
256                 --type=System.Environment --type=System.Array \
257                 -o Test/en.expected.importecmadoc Test/DocTest.dll 
258
259 check-monodocer-importecmadoc: $(PROGRAM)
260         rm -Rf Test/en.actual
261         $(MAKE) Test/DocTest.dll-v1
262         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
263                 '--type=System.Action`1' --type=System.AsyncCallback \
264                 --type=System.Environment --type=System.Array \
265                 -o Test/en.actual Test/DocTest.dll 
266         diff --exclude=.svn -rup Test/en.expected.importecmadoc Test/en.actual
267
268 check-mdoc-export-html-update: $(PROGRAM)
269         find Test/html.expected -name \*.html -exec rm "{}" \;
270         $(MONO) $(PROGRAM) export-html -o Test/html.expected \
271                 Test/en.expected.importslashdoc 
272
273 check-mdoc-export-html: check-monodocer $(PROGRAM)
274         rm -Rf Test/html.actual
275         $(MONO) $(PROGRAM) export-html -o Test/html.actual \
276                 Test/en.expected.importslashdoc
277         diff --exclude=.svn -rup Test/html.expected Test/html.actual
278
279 check-mdoc-export-html-with-version: $(PROGRAM)
280         rm -Rf Test/html.actual.v0 Test/html.actual.since-with-v0 .v0.txt .v2.txt
281         $(MONO) $(PROGRAM) export-html -o Test/html.actual.v0 \
282                 Test/en.expected
283         $(MONO) $(PROGRAM) export-html -o Test/html.actual.since-with-v0 \
284                 Test/en.expected.since -with-version 0.0.0.0
285         (cd Test/html.actual.v0            && find . -type f) | sort > .v0.txt
286         (cd Test/html.actual.since-with-v0 && find . -type f) | sort > .v2.txt
287         diff -rup .v0.txt .v2.txt   # assert no types added
288
289 check-md-html-dir: $(PROGRAM)
290         rm -Rf Test/html.actual
291         $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
292         diff --exclude=.svn -rup Test/html.expected Test/html.actual
293
294 check-mdoc-export-msxdoc-update:
295         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
296                 > Test/msxdoc-expected.importslashdoc.xml
297
298 check-mdoc-export-msxdoc:
299         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
300                 | diff --brief - Test/msxdoc-expected.importslashdoc.xml
301
302 my_abs_top_srcdir = $(shell cd . && pwd)
303
304 check-mdoc-validate-update: $(PROGRAM)
305         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
306                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
307                 Test/validate.check.monodocer
308         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
309                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
310                 Test/validate.check.monodocer.importslashdoc
311         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
312                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
313                 Test/validate.check.monodocer.since
314
315 check-mdoc-validate: $(PROGRAM)
316         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
317                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
318                 diff - Test/validate.check.monodocer
319         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
320                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
321                 diff --brief - Test/validate.check.monodocer.importslashdoc
322         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
323                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
324                 diff --brief - Test/validate.check.monodocer.since
325
326 run-test-local: check-doc-tools
327
328 run-test-update : check-doc-tools-update
329
330 check-doc-tools: check-monodocer-since \
331         check-monodocer-importecmadoc \
332         check-monodocer-importslashdoc \
333         check-monodocer \
334         check-monodocer-delete \
335         check-mdoc-export-html \
336         check-mdoc-export-html-with-version \
337         check-mdoc-export-msxdoc \
338         check-mdoc-validate
339
340 check-doc-tools-update: check-monodocer-since-update \
341         check-monodocer-importecmadoc-update \
342         check-monodocer-importslashdoc-update \
343         check-monodocer-update \
344         check-monodocer-dropns-classic \
345         check-monodocer-dropns-classic-withsecondary \
346         check-monodocer-internal-interface \
347         check-monodocer-enumerations \
348         check-monodocer-delete-update \
349         check-mdoc-export-html-update \
350         check-mdoc-export-msxdoc-update \
351         check-mdoc-validate-update 
352
353 check: check-doc-tools \
354         check-doc-tools-update
355