3 include ../../build/rules.make
4 export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
6 # corlib is crazy to build so we skip build/library.make and do stuff
9 # Here, we define a bunch of variables.
11 ifdef PLATFORM_MONO_NATIVE
12 test_against = $(corlib)
14 test_against = $(reslib)
17 LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 -d:INSIDE_CORLIB
19 gmcs = $(topdir)/gmcs/gmcs.exe
21 corlib = $(topdir)/class/lib/$(PROFILE)/mscorlib.dll
22 testlib = corlib_test.dll
23 cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
24 reslib = $(topdir)/class/lib/$(PROFILE)/corlib_res.dll
25 plattestlib = corlib_plattest.dll
27 corpdb = $(patsubst %.dll,%.pdb,$(corlib))
28 testpdb = $(patsubst %.dll,%.pdb,$(testlib))
29 cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
30 respdb = $(patsubst %.dll,%.pdb,$(reslib))
31 plattestpdb = $(patsubst %.dll,%.pdb,$(plattestlib))
33 sourcefile = corlib.dll.sources
34 response = $(depsdir)/$(PROFILE)_corlib.dll.response
35 makefrag = $(depsdir)/$(PROFILE)_corlib.dll.makefrag
36 stampfile = $(depsdir)/$(PROFILE)_corlib.dll.stamp
37 # disable, until people fix their code...
38 #corlib_flags = /unsafe /nostdlib /d:INSIDE_CORLIB
39 corlib_flags = /unsafe /nostdlib
41 net_2_0_bootstrap_response = $(depsdir)/corlib_net_2_0_bootstrap.dll.response
42 net_2_0_bootstrap_makefrag = $(depsdir)/corlib_net_2_0_bootstrap.dll.makefrag
43 net_2_0_bootstrap_stampfile = $(depsdir)/corlib_net_2_0_bootstrap.dll.stamp
45 net_2_0_response = $(depsdir)/corlib_net_2_0.dll.response
46 net_2_0_makefrag = $(depsdir)/corlib_net_2_0.dll.makefrag
47 net_2_0_stampfile = $(depsdir)/corlib_net_2_0.dll.stamp
49 test_sourcefile = corlib_test.dll.sources
50 test_response = $(depsdir)/$(PROFILE)_$(testlib).response
51 test_makefrag = $(depsdir)/$(PROFILE)_$(testlib).makefrag
52 test_stampfile = $(depsdir)/$(PROFILE)_$(testlib).stamp
53 test_nunitfw = $(topdir)/class/lib/$(PROFILE)/nunit.framework.dll
54 test_flags = /nowarn:0618 /nowarn:0672 /unsafe /r:$(test_against) /r:$(test_nunitfw)
56 cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
57 cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
58 cmp_stampfile = $(depsdir)/$(PROFILE)_corlib_cmp.dll.stamp
59 cmp_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
61 res_response = $(depsdir)/$(PROFILE)_corlib_res.dll.response
62 res_makefrag = $(depsdir)/$(PROFILE)_corlib_res.dll.makefrag
63 res_stampfile = $(depsdir)/$(PROFILE)_corlib_res.dll.stamp
64 res_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
66 plattest_excludes = corlib_plattest.dll.excludes
67 plattest_response = $(depsdir)/$(PROFILE)_$(plattestlib).response
68 plattest_makefrag = $(depsdir)/$(PROFILE)_$(plattestlib).makefrag
69 plattest_stampfile = $(depsdir)/$(PROFILE)_$(plattestlib).stamp
70 plattest_flags = /debug+ /debug:full /nowarn:0618 /nowarn:0672 /unsafe /r:$(PLATFORM_CORLIB) /r:$(test_nunitfw)
76 install-local: $(corlib) $(makefrag)
77 @if test $(PROFILE) = "net_2_0" ; then \
78 echo $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/net_2_0 ; \
79 $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib/net_2_0 ; \
80 echo $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib/net_2_0 ; \
81 $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib/net_2_0 ; \
83 echo $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib ; \
84 $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib ; \
85 echo $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib ; \
86 $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib ; \
90 @if test $(PROFILE) = "net_2_0" ; then \
91 -rm -f $(DESTDIR)$(prefix)/lib/net_2_0/corlib.dll
93 -rm -f $(DESTDIR)$(prefix)/lib/corlib.dll
97 -rm -f $(corlib) $(cmplib) $(testlib) $(reslib) $(plattestlib) TestResult.xml \
98 $(response) $(makefrag) $(stampfile) \
99 $(net_2_0_bootstrap_response) $(net_2_0_bootstrap_makefrag) $(net_2_0_bootstrap_stampfile) \
100 $(net_2_0_response) $(net_2_0_makefrag) $(net_2_0_stampfile) \
101 $(test_response) $(test_makefrag) $(test_stampfile) \
102 $(cmp_response) $(cmp_makefrag) $(cmp_stampfile) \
103 $(res_response) $(res_makefrag) $(res_stampfile) \
104 $(plattest_response) $(plattest_makefrag) $(plattest_stampfile) \
105 $(corpdb) $(cmppdb) $(testpdb) $(respdb) $(plattestpdb)
108 # If building on a non mono-native platform, default
109 # to running the unit tests on its corlib, to see if
110 # our tests are complaint with their (hopefully bug-free)
111 # corlib. If on a mono-native platform, test our actual
114 # You can access either one on demand with either 'make
115 # run-monotest' or 'make run-plattest'.
118 (cd ${topdir}/nunit20 && make)
120 ifdef PLATFORM_MONO_NATIVE
121 test-local: $(test_nunitfw) $(test_against) $(testlib)
123 run-test-local: run-monotest
125 test-local: $(test_nunitfw) $(plattestlib)
127 run-test-local: run-plattest
130 run-monotest: $(test_against) $(testlib)
131 $(TEST_RUNTIME) $(TEST_HARNESS) $(testlib)
133 run-plattest: $(plattestlib)
134 $(TEST_RUNTIME) $(TEST_HARNESS) $(plattestlib)
136 # OK, that was the easy part. Now we get to the fun bits.
140 DISTFILES = $(sourcefile) $(test_sourcefile) \
141 corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
142 $(plattest_excludes) \
145 # see $(topdir)/build/library.make for explanation of what's going on
148 dist-local: dist-default
149 for f in `cat $(sourcefile)` `cat $(test_sourcefile) |sed -e 's,^\(.\),Test/\1,'` ; do \
150 dest=`dirname $(distdir)/$$f` ; \
151 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
156 $(corlib): $(makefrag) $(response) $(stampfile)
157 @if test $(PROFILE) = "net_2_0" ; then \
158 $(MAKE) corlib_net_2_0 || exit 1 ; \
160 $(MAKE) corlib_compile || exit 1 ; \
163 corlib_compile: $(makefrag) $(response) $(stampfile)
164 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(corlib_flags) /target:library /out:../lib/default/mscorlib.dll @$(response)
166 # A bootstrap corlib 2.0 needs to be built so gmcs can be built and the full net 2.0 corlib can be built
169 corlib_net_2_0: corlib_net_2_0_compile
171 corlib_net_2_0_compile: corlib_net_2_0_bootstrap $(net_2_0_makefrag) $(net_2_0_response) $(net_2_0_stampfile) $(gmcs)
172 MONO_PATH="../lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(gmcs) $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(corlib_flags) /define:NET_1_1 /define:NET_2_0 /target:library /out:../lib/net_2_0/mscorlib.dll @$(net_2_0_response)
174 corlib_net_2_0_bootstrap: $(net_2_0_bootstrap_response) $(net_2_0_bootstrap_stampfile)
175 $(BOOTSTRAP_MCS) /nowarn:649 /nowarn:169 /define:INSIDE_CORLIB /define:NET_1_1 /define:BOOTSTRAP_NET_2_0 $(corlib_flags) /target:library /out:../lib/net_2_0_bootstrap/mscorlib.dll @$(net_2_0_bootstrap_response)
177 # make sure that $(gmcs) is up-to-date
180 cd $(topdir)/gmcs && $(MAKE) ;
182 $(response): $(sourcefile)
183 @echo Creating $@ ...
184 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
185 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
187 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
190 # warning: embedded tab in the 'echo touch' line
191 $(makefrag): $(response)
192 @echo Creating $@ ...
193 @echo "HAVE_MAKEFRAG = yes" >$@.new
194 @echo "$(stampfile): \\" >>$@.new
195 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
196 @cat $@.new |sed -e '$$s, \\$$,,' >$@
197 @echo " touch \$$@" >>$@
209 $(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
210 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
212 $(cmp_response): $(response) corlib_cmp.dll.excludes
213 @echo Creating $@ ...
214 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
215 @cat corlib_cmp.dll.excludes |$(PLATFORM_CHANGE_SEPARATOR_CMD) |cat - $< |sort |uniq -u >$@
217 @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
220 # warning: embedded tab in the 'echo touch' line
221 $(cmp_makefrag): $(cmp_response)
222 @echo Creating $@ ...
223 @echo "HAVE_CMP_MAKEFRAG = yes" >$@.new
224 @echo "$(cmp_stampfile): \\" >>$@.new
225 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
226 @cat $@.new |sed -e '$$s, \\$$,,' >$@
227 @echo " touch \$$@" >>$@
230 # Since we make corlib_cmp on demand, there isn't a real need
231 # to have full dep tracking for it. Also, the generation of this
232 # file is busted on Win32 ('sort' seems to mess up line endings),
233 # leading to a broken build.
235 # -include $(cmp_makefrag)
237 ifndef HAVE_CMP_MAKEFRAG
244 $(reslib): $(res_makefrag) $(res_response) $(res_stampfile)
245 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
247 $(res_response): $(sourcefile) corlib_res.dll.excludes
248 @echo Creating $@ ...
249 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
250 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
252 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u >$@
255 # warning: embedded tab in the 'echo touch' line
256 $(res_makefrag): $(res_response)
257 @echo Creating $@ ...
258 @echo "HAVE_RES_MAKEFRAG = yes" >$@.new
259 @echo "$(res_stampfile): \\" >>$@.new
260 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
261 @cat $@.new |sed -e '$$s, \\$$,,' >$@
262 @echo " touch \$$@" >>$@
265 -include $(res_makefrag)
267 ifndef HAVE_RES_MAKEFRAG
274 $(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
275 $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
277 $(test_response): $(test_sourcefile)
278 @echo Creating $@ ...
279 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
280 @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
282 @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
285 # warning: embedded tab in the 'echo touch' line
286 $(test_makefrag): $(test_response)
287 @echo Creating $@ ...
288 @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new
289 @echo "$(test_stampfile): \\" >>$@.new
290 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
291 @cat $@.new |sed -e '$$s, \\$$,,' >$@
292 @echo " touch \$$@" >>$@
295 -include $(test_makefrag)
297 ifndef HAVE_TEST_MAKEFRAG
304 $(plattestlib): $(plattest_makefrag) $(plattest_response) $(plattest_stampfile)
305 $(INTERNAL_MCS) $(plattest_flags) /target:library /out:$@ @$(plattest_response)
306 #$(CSCOMPILE) $(plattest_flags) /target:library /out:$@ @$(plattest_response)
308 $(plattest_response): $(test_sourcefile) $(plattest_excludes)
309 @echo Creating $@ ...
310 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
311 ifdef PLATFORM_MONO_NATIVE
312 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
314 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
317 ifdef PLATFORM_MONO_NATIVE
318 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
320 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
324 # warning: embedded tab in the 'echo touch' line
325 $(plattest_makefrag): $(plattest_response)
326 @echo Creating $@ ...
327 @echo "HAVE_PLATTEST_MAKEFRAG = yes" >$@.new
328 @echo "$(plattest_stampfile): \\" >>$@.new
329 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
330 @cat $@.new |sed -e '$$s, \\$$,,' >$@
331 @echo " touch \$$@" >>$@
334 -include $(plattest_makefrag)
336 ifndef HAVE_PLATTEST_MAKEFRAG
337 $(plattest_stampfile):
343 $(net_2_0_bootstrap_response): $(sourcefile)
344 @echo Creating $@ ...
345 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
346 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
348 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
351 # warning: embedded tab in the 'echo touch' line
352 $(net_2_0_boostrap_makefrag): $(net_2_0_boostrap_response)
353 @echo Creating $@ ...
354 @echo "HAVE_NET_2_0_BOOTSTRAP_MAKEFRAG = yes" >$@.new
355 @echo "$(net_2_0_bootstrap_stampfile): \\" >>$@.new
356 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
357 @cat $@.new |sed -e '$$s, \\$$,,' >$@
358 @echo " touch \$$@" >>$@
361 -include $(net_2_0_bootstrap_makefrag)
363 ifndef HAVE_NET_2_0_BOOTSTRAP_MAKEFRAG
364 $(net_2_0_bootstrap_stampfile):
370 $(net_2_0_response): $(sourcefile)
371 @echo Creating $@ ...
372 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
373 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
375 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
378 # warning: embedded tab in the 'echo touch' line
379 $(net_2_0_makefrag): $(net_2_0_response)
380 @echo Creating $@ ...
381 @echo "HAVE_NET_2_0_MAKEFRAG = yes" >$@.new
382 @echo "$(net_2_0_stampfile): \\" >>$@.new
383 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
384 @cat $@.new |sed -e '$$s, \\$$,,' >$@
385 @echo " touch \$$@" >>$@
388 -include $(net_2_0_makefrag)
390 ifndef HAVE_NET_2_0_MAKEFRAG
391 $(net_2_0_stampfile):