3 include ../../build/rules.make
5 # corlib is crazy to build so we skip build/library.make and do stuff
8 # Here, we define a bunch of variables.
10 ifdef PLATFORM_MONO_NATIVE
11 test_against = $(corlib)
13 test_against = $(reslib)
16 LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 -d:INSIDE_CORLIB
18 corlib = $(topdir)/class/lib/mscorlib.dll
19 testlib = corlib_test.dll
20 cmplib = $(topdir)/class/lib/corlib_cmp.dll
21 reslib = $(topdir)/class/lib/corlib_res.dll
22 plattestlib = corlib_plattest.dll
24 corpdb = $(patsubst %.dll,%.pdb,$(corlib))
25 testpdb = $(patsubst %.dll,%.pdb,$(testlib))
26 cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
27 respdb = $(patsubst %.dll,%.pdb,$(reslib))
28 plattestpdb = $(patsubst %.dll,%.pdb,$(plattestlib))
30 sourcefile = corlib.dll.sources
31 response = $(depsdir)/corlib.dll.response
32 makefrag = $(depsdir)/corlib.dll.makefrag
33 stampfile = $(depsdir)/corlib.dll.stamp
34 # disable, until people fix their code...
35 #corlib_flags = /unsafe /nostdlib /d:INSIDE_CORLIB
36 corlib_flags = /unsafe /nostdlib
38 test_sourcefile = corlib_test.dll.sources
39 test_response = $(depsdir)/$(testlib).response
40 test_makefrag = $(depsdir)/$(testlib).makefrag
41 test_stampfile = $(depsdir)/$(testlib).stamp
42 test_flags = /nowarn:0618 /nowarn:0672 /r:$(test_against) /r:$(topdir)/class/lib/NUnit.Framework.dll
44 cmp_response = $(depsdir)/corlib_cmp.dll.response
45 cmp_makefrag = $(depsdir)/corlib_cmp.dll.makefrag
46 cmp_stampfile = $(depsdir)/corlib_cmp.dll.stamp
47 cmp_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
49 res_response = $(depsdir)/corlib_res.dll.response
50 res_makefrag = $(depsdir)/corlib_res.dll.makefrag
51 res_stampfile = $(depsdir)/corlib_res.dll.stamp
52 res_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
54 plattest_excludes = corlib_plattest.dll.excludes
55 plattest_response = $(depsdir)/$(plattestlib).response
56 plattest_makefrag = $(depsdir)/$(plattestlib).makefrag
57 plattest_stampfile = $(depsdir)/$(plattestlib).stamp
58 plattest_flags = /debug+ /debug:full /nowarn:0618 /nowarn:0672 /r:$(PLATFORM_CORLIB) /r:$(topdir)/class/lib/NUnit.Framework.dll
64 install-local: $(corlib) $(makefrag)
65 $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib
66 $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib
69 -rm -f $(DESTDIR)$(prefix)/lib/corlib.dll
72 -rm -f $(corlib) $(cmplib) $(testlib) $(reslib) $(plattestlib) TestResult.xml \
73 $(response) $(makefrag) $(stampfile) \
74 $(test_response) $(test_makefrag) $(test_stampfile) \
75 $(cmp_response) $(cmp_makefrag) $(cmp_stampfile) \
76 $(res_response) $(res_makefrag) $(res_stampfile) \
77 $(plattest_response) $(plattest_makefrag) $(plattest_stampfile) \
78 $(corpdb) $(cmppdb) $(testpdb) $(respdb) $(plattestpdb)
81 # If building on a non mono-native platform, default
82 # to running the unit tests on its corlib, to see if
83 # our tests are complaint with their (hopefully bug-free)
84 # corlib. If on a mono-native platform, test our actual
87 # You can access either one on demand with either 'make
88 # run-monotest' or 'make run-plattest'.
90 ifdef PLATFORM_MONO_NATIVE
91 test-local: $(test_against) $(testlib)
93 run-test-local: run-monotest
95 test-local: $(plattestlib)
97 run-test-local: run-plattest
100 run-monotest: $(test_against) $(testlib)
101 $(TEST_RUNTIME) $(TEST_HARNESS) $(testlib)
103 run-plattest: $(plattestlib)
104 $(TEST_RUNTIME) $(TEST_HARNESS) $(plattestlib)
106 # OK, that was the easy part. Now we get to the fun bits.
110 DISTFILES = $(sourcefile) $(test_sourcefile) \
111 corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
112 $(plattest_excludes) \
115 # see $(topdir)/build/library.make for explanation of what's going on
118 dist-local: dist-default
119 for f in `cat $(sourcefile)` `cat $(test_sourcefile) |sed -e 's,^\(.\),Test/\1,'` ; do \
120 dest=`dirname $(distdir)/$$f` ; \
121 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
126 $(corlib): $(makefrag) $(response) $(stampfile)
127 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(corlib_flags) /target:library /out:$@ @$(response)
129 $(response): $(sourcefile)
130 @echo Creating $@ ...
131 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
132 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
134 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
137 # warning: embedded tab in the 'echo touch' line
138 $(makefrag): $(response)
139 @echo Creating $@ ...
140 @echo "HAVE_MAKEFRAG = yes" >$@.new
141 @echo "$(stampfile): \\" >>$@.new
142 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
143 @cat $@.new |sed -e '$$s, \\$$,,' >$@
144 @echo " touch \$$@" >>$@
156 $(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
157 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
159 $(cmp_response): $(response) corlib_cmp.dll.excludes
160 @echo Creating $@ ...
161 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
162 @cat corlib_cmp.dll.excludes |$(PLATFORM_CHANGE_SEPARATOR_CMD) |cat - $< |sort |uniq -u >$@
164 @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
167 # warning: embedded tab in the 'echo touch' line
168 $(cmp_makefrag): $(cmp_response)
169 @echo Creating $@ ...
170 @echo "HAVE_CMP_MAKEFRAG = yes" >$@.new
171 @echo "$(cmp_stampfile): \\" >>$@.new
172 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
173 @cat $@.new |sed -e '$$s, \\$$,,' >$@
174 @echo " touch \$$@" >>$@
177 # Since we make corlib_cmp on demand, there isn't a real need
178 # to have full dep tracking for it. Also, the generation of this
179 # file is busted on Win32 ('sort' seems to mess up line endings),
180 # leading to a broken build.
182 # -include $(cmp_makefrag)
184 ifndef HAVE_CMP_MAKEFRAG
191 $(reslib): $(res_makefrag) $(res_response) $(res_stampfile)
192 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
194 $(res_response): $(sourcefile) corlib_res.dll.excludes
195 @echo Creating $@ ...
196 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
197 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
199 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u >$@
202 # warning: embedded tab in the 'echo touch' line
203 $(res_makefrag): $(res_response)
204 @echo Creating $@ ...
205 @echo "HAVE_RES_MAKEFRAG = yes" >$@.new
206 @echo "$(res_stampfile): \\" >>$@.new
207 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
208 @cat $@.new |sed -e '$$s, \\$$,,' >$@
209 @echo " touch \$$@" >>$@
212 -include $(res_makefrag)
214 ifndef HAVE_RES_MAKEFRAG
221 $(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
222 $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
224 $(test_response): $(test_sourcefile)
225 @echo Creating $@ ...
226 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
227 @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
229 @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
232 # warning: embedded tab in the 'echo touch' line
233 $(test_makefrag): $(test_response)
234 @echo Creating $@ ...
235 @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new
236 @echo "$(test_stampfile): \\" >>$@.new
237 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
238 @cat $@.new |sed -e '$$s, \\$$,,' >$@
239 @echo " touch \$$@" >>$@
242 -include $(test_makefrag)
244 ifndef HAVE_TEST_MAKEFRAG
251 $(plattestlib): $(plattest_makefrag) $(plattest_response) $(plattest_stampfile)
252 $(CSCOMPILE) $(plattest_flags) /target:library /out:$@ @$(plattest_response)
254 $(plattest_response): $(test_sourcefile) $(plattest_excludes)
255 @echo Creating $@ ...
256 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
257 ifdef PLATFORM_MONO_NATIVE
258 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
260 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
263 ifdef PLATFORM_MONO_NATIVE
264 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
266 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
270 # warning: embedded tab in the 'echo touch' line
271 $(plattest_makefrag): $(plattest_response)
272 @echo Creating $@ ...
273 @echo "HAVE_PLATTEST_MAKEFRAG = yes" >$@.new
274 @echo "$(plattest_stampfile): \\" >>$@.new
275 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
276 @cat $@.new |sed -e '$$s, \\$$,,' >$@
277 @echo " touch \$$@" >>$@
280 -include $(plattest_makefrag)
282 ifndef HAVE_PLATTEST_MAKEFRAG
283 $(plattest_stampfile):