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 $(makefrag): $(response)
138 @echo Creating $@ ...
139 @echo "HAVE_MAKEFRAG = yes" >$@.new
140 @echo "$(stampfile): \\" >>$@.new
141 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
142 @cat $@.new |sed -e '$$s, \\$$,,' >$@
143 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
155 $(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
156 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
158 $(cmp_response): $(response) corlib_cmp.dll.excludes
159 @echo Creating $@ ...
160 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
161 @cat corlib_cmp.dll.excludes |$(PLATFORM_CHANGE_SEPARATOR_CMD) |cat - $< |sort |uniq -u >$@
163 @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
166 $(cmp_makefrag): $(cmp_response)
167 @echo Creating $@ ...
168 @echo "HAVE_CMP_MAKEFRAG = yes" >$@.new
169 @echo "$(cmp_stampfile): \\" >>$@.new
170 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
171 @cat $@.new |sed -e '$$s, \\$$,,' >$@
172 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
175 # Since we make corlib_cmp on demand, there isn't a real need
176 # to have full dep tracking for it. Also, the generation of this
177 # file is busted on Win32 ('sort' seems to mess up line endings),
178 # leading to a broken build.
180 # -include $(cmp_makefrag)
182 ifndef HAVE_CMP_MAKEFRAG
189 $(reslib): $(res_makefrag) $(res_response) $(res_stampfile)
190 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
192 $(res_response): $(sourcefile) corlib_res.dll.excludes
193 @echo Creating $@ ...
194 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
195 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
197 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u >$@
200 $(res_makefrag): $(res_response)
201 @echo Creating $@ ...
202 @echo "HAVE_RES_MAKEFRAG = yes" >$@.new
203 @echo "$(res_stampfile): \\" >>$@.new
204 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
205 @cat $@.new |sed -e '$$s, \\$$,,' >$@
206 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
209 -include $(res_makefrag)
211 ifndef HAVE_RES_MAKEFRAG
218 $(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
219 $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
221 $(test_response): $(test_sourcefile)
222 @echo Creating $@ ...
223 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
224 @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
226 @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
229 $(test_makefrag): $(test_response)
230 @echo Creating $@ ...
231 @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new
232 @echo "$(test_stampfile): \\" >>$@.new
233 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
234 @cat $@.new |sed -e '$$s, \\$$,,' >$@
235 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
238 -include $(test_makefrag)
240 ifndef HAVE_TEST_MAKEFRAG
247 $(plattestlib): $(plattest_makefrag) $(plattest_response) $(plattest_stampfile)
248 $(CSCOMPILE) $(plattest_flags) /target:library /out:$@ @$(plattest_response)
250 $(plattest_response): $(test_sourcefile) $(plattest_excludes)
251 @echo Creating $@ ...
252 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
253 ifdef PLATFORM_MONO_NATIVE
254 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
256 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
259 ifdef PLATFORM_MONO_NATIVE
260 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
262 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
266 $(plattest_makefrag): $(plattest_response)
267 @echo Creating $@ ...
268 @echo "HAVE_PLATTEST_MAKEFRAG = yes" >$@.new
269 @echo "$(plattest_stampfile): \\" >>$@.new
270 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
271 @cat $@.new |sed -e '$$s, \\$$,,' >$@
272 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
275 -include $(plattest_makefrag)
277 ifndef HAVE_PLATTEST_MAKEFRAG
278 $(plattest_stampfile):