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
17 corlib = $(topdir)/class/lib/corlib.dll
18 testlib = corlib_test.dll
19 cmplib = $(topdir)/class/lib/corlib_cmp.dll
20 reslib = $(topdir)/class/lib/corlib_res.dll
21 plattestlib = corlib_plattest.dll
23 corpdb = $(patsubst %.dll,%.pdb,$(corlib))
24 testpdb = $(patsubst %.dll,%.pdb,$(testlib))
25 cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
26 respdb = $(patsubst %.dll,%.pdb,$(reslib))
27 plattestpdb = $(patsubst %.dll,%.pdb,$(plattestlib))
29 sourcefile = corlib.dll.sources
30 response = $(depsdir)/corlib.dll.response
31 makefrag = $(depsdir)/corlib.dll.makefrag
32 stampfile = $(depsdir)/corlib.dll.stamp
33 # disable, until people fix their code...
34 #corlib_flags = /unsafe /nostdlib /d:INSIDE_CORLIB
35 corlib_flags = /unsafe /nostdlib
37 test_sourcefile = corlib_test.dll.sources
38 test_response = $(depsdir)/$(testlib).response
39 test_makefrag = $(depsdir)/$(testlib).makefrag
40 test_stampfile = $(depsdir)/$(testlib).stamp
41 test_flags = /nowarn:0618 /nowarn:0672 /r:$(test_against) /r:$(topdir)/class/lib/NUnit.Framework.dll
43 cmp_response = $(depsdir)/corlib_cmp.dll.response
44 cmp_makefrag = $(depsdir)/corlib_cmp.dll.makefrag
45 cmp_stampfile = $(depsdir)/corlib_cmp.dll.stamp
46 cmp_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
48 res_response = $(depsdir)/corlib_res.dll.response
49 res_makefrag = $(depsdir)/corlib_res.dll.makefrag
50 res_stampfile = $(depsdir)/corlib_res.dll.stamp
51 res_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
53 plattest_excludes = corlib_plattest.dll.excludes
54 plattest_response = $(depsdir)/$(plattestlib).response
55 plattest_makefrag = $(depsdir)/$(plattestlib).makefrag
56 plattest_stampfile = $(depsdir)/$(plattestlib).stamp
57 plattest_flags = /debug+ /debug:full /nowarn:0618 /nowarn:0672 /r:$(PLATFORM_CORLIB) /r:$(topdir)/class/lib/NUnit.Framework.dll
63 install-local: $(corlib)
64 $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib
65 $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib
68 -rm -f $(corlib) $(cmplib) $(testlib) $(reslib) $(plattestlib) TestResult.xml \
69 $(response) $(makefrag) $(stampfile) \
70 $(test_response) $(test_makefrag) $(test_stampfile) \
71 $(cmp_response) $(cmp_makefrag) $(cmp_stampfile) \
72 $(res_response) $(res_makefrag) $(res_stampfile) \
73 $(plattest_response) $(plattest_makefrag) $(plattest_stampfile) \
74 $(corpdb) $(cmppdb) $(testpdb) $(respdb) $(plattestpdb)
77 # If building on a non mono-native platform, default
78 # to running the unit tests on its corlib, to see if
79 # our tests are complaint with their (hopefully bug-free)
80 # corlib. If on a mono-native platform, test our actual
83 # You can access either one on demand with either 'make
84 # run-monotest' or 'make run-plattest'.
86 ifdef PLATFORM_MONO_NATIVE
87 test-local: $(test_against) $(testlib)
89 run-test-local: run-monotest
91 test-local: $(plattestlib)
93 run-test-local: run-plattest
96 run-monotest: $(test_against) $(testlib)
97 $(TEST_RUNTIME) $(TEST_HARNESS) $(testlib)
99 run-plattest: $(plattestlib)
100 $(TEST_RUNTIME) $(TEST_HARNESS) $(plattestlib)
102 # OK, that was the easy part. Now we get to the fun bits.
106 DISTFILES = $(sourcefile) $(test_sourcefile) \
107 corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
108 $(plattest_excludes) \
111 # see $(topdir)/build/library.make for explanation of what's going on
114 dist-local: dist-default
115 for f in `cat $(sourcefile)` `cat $(test_sourcefile) |sed -e 's,^\(.\),Test/\1,'` ; do \
116 dest=`dirname $(distdir)/$$f` ; \
117 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
122 $(corlib): $(makefrag) $(response) $(stampfile)
123 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(corlib_flags) /target:library /out:$@ @$(response)
125 $(response): $(sourcefile)
126 @echo Creating $@ ...
127 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
128 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
130 @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
133 $(makefrag): $(response)
134 @echo Creating $@ ...
135 @echo "HAVE_MAKEFRAG = yes" >$@.new
136 @echo "$(stampfile): \\" >>$@.new
137 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
138 @cat $@.new |sed -e '$$s, \\$$,,' >$@
139 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
151 $(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
152 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
154 $(cmp_response): $(response) corlib_cmp.dll.excludes
155 @echo Creating $@ ...
156 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
157 @cat corlib_cmp.dll.excludes |$(PLATFORM_CHANGE_SEPARATOR_CMD) |cat - $< |sort |uniq -u >$@
159 @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
162 $(cmp_makefrag): $(cmp_response)
163 @echo Creating $@ ...
164 @echo "HAVE_CMP_MAKEFRAG = yes" >$@.new
165 @echo "$(cmp_stampfile): \\" >>$@.new
166 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
167 @cat $@.new |sed -e '$$s, \\$$,,' >$@
168 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
171 # Since we make corlib_cmp on demand, there isn't a real need
172 # to have full dep tracking for it. Also, the generation of this
173 # file is busted on Win32 ('sort' seems to mess up line endings),
174 # leading to a broken build.
176 # -include $(cmp_makefrag)
178 ifndef HAVE_CMP_MAKEFRAG
185 $(reslib): $(res_makefrag) $(res_response) $(res_stampfile)
186 $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
188 $(res_response): $(sourcefile) corlib_res.dll.excludes
189 @echo Creating $@ ...
190 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
191 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
193 @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u >$@
196 $(res_makefrag): $(res_response)
197 @echo Creating $@ ...
198 @echo "HAVE_RES_MAKEFRAG = yes" >$@.new
199 @echo "$(res_stampfile): \\" >>$@.new
200 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
201 @cat $@.new |sed -e '$$s, \\$$,,' >$@
202 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
205 -include $(res_makefrag)
207 ifndef HAVE_RES_MAKEFRAG
214 $(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
215 $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
217 $(test_response): $(test_sourcefile)
218 @echo Creating $@ ...
219 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
220 @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
222 @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
225 $(test_makefrag): $(test_response)
226 @echo Creating $@ ...
227 @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new
228 @echo "$(test_stampfile): \\" >>$@.new
229 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
230 @cat $@.new |sed -e '$$s, \\$$,,' >$@
231 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
234 -include $(test_makefrag)
236 ifndef HAVE_TEST_MAKEFRAG
243 $(plattestlib): $(plattest_makefrag) $(plattest_response) $(plattest_stampfile)
244 $(CSCOMPILE) $(plattest_flags) /target:library /out:$@ @$(plattest_response)
246 $(plattest_response): $(test_sourcefile) $(plattest_excludes)
247 @echo Creating $@ ...
248 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
249 ifdef PLATFORM_MONO_NATIVE
250 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
252 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
255 ifdef PLATFORM_MONO_NATIVE
256 @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
258 @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
262 $(plattest_makefrag): $(plattest_response)
263 @echo Creating $@ ...
264 @echo "HAVE_PLATTEST_MAKEFRAG = yes" >$@.new
265 @echo "$(plattest_stampfile): \\" >>$@.new
266 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
267 @cat $@.new |sed -e '$$s, \\$$,,' >$@
268 @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
271 -include $(plattest_makefrag)
273 ifndef HAVE_PLATTEST_MAKEFRAG
274 $(plattest_stampfile):