* Makefile: corlib is now named mscorlib.
[mono.git] / mcs / class / corlib / Makefile
1 thisdir = class/corlib
2 SUBDIRS =
3 include ../../build/rules.make
4
5 # corlib is crazy to build so we skip build/library.make and do stuff
6 # ourselves.
7 #
8 # Here, we define a bunch of variables.
9
10 ifdef PLATFORM_MONO_NATIVE
11 test_against = $(corlib)
12 else
13 test_against = $(reslib)
14 endif
15
16 LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 -d:INSIDE_CORLIB
17
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
23
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))
29
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
37
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
43
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)
48
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)
53
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
59
60 # Here, we make all.
61
62 all-local: $(corlib)
63
64 install-local: $(corlib) $(makefrag)
65         $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib
66         $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib
67
68 uninstall-local:
69         -rm -f $(DESTDIR)$(prefix)/lib/corlib.dll
70
71 clean-local:
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)
79
80
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
85 # corlib.
86 #
87 # You can access either one on demand with either 'make
88 # run-monotest' or 'make run-plattest'.
89
90 ifdef PLATFORM_MONO_NATIVE
91 test-local: $(test_against) $(testlib)
92
93 run-test-local: run-monotest
94 else
95 test-local: $(plattestlib)
96
97 run-test-local: run-plattest
98 endif
99
100 run-monotest: $(test_against) $(testlib)
101         $(TEST_RUNTIME) $(TEST_HARNESS) $(testlib)
102
103 run-plattest: $(plattestlib)
104         $(TEST_RUNTIME) $(TEST_HARNESS) $(plattestlib)
105
106 # OK, that was the easy part. Now we get to the fun bits.
107 #
108 # first, make dist.
109
110 DISTFILES = $(sourcefile) $(test_sourcefile) \
111         corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
112         $(plattest_excludes) \
113         Test/ms_run_test.sh
114
115 # see $(topdir)/build/library.make for explanation of what's going on
116 # here.
117
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 ; \
122         done
123
124 # plain ol corlib
125
126 $(corlib): $(makefrag) $(response) $(stampfile)
127         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(corlib_flags) /target:library /out:$@ @$(response)
128
129 $(response): $(sourcefile)
130         @echo Creating $@ ...
131 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
132         @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
133 else
134         @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
135 endif
136
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 \$$@" >>$@
144         @rm -rf $@.new
145
146 -include $(makefrag)
147
148 ifndef HAVE_MAKEFRAG
149 $(stampfile):
150         touch $@
151 endif
152
153 # corlib_cmp
154
155 $(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
156         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
157
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 >$@
162 else
163         @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
164 endif
165
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 \$$@" >>$@
173         @rm -rf $@.new
174
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.
179 #
180 # -include $(cmp_makefrag)
181
182 ifndef HAVE_CMP_MAKEFRAG
183 $(cmp_stampfile):
184         touch $@
185 endif
186
187 # corlib_res
188
189 $(reslib): $(res_makefrag) $(res_response) $(res_stampfile)
190         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
191
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) >$@
196 else
197         @cat corlib_res.dll.excludes $(sourcefile) |sort |uniq -u >$@
198 endif
199
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 \$$@" >>$@
207         @rm -rf $@.new
208
209 -include $(res_makefrag)
210
211 ifndef HAVE_RES_MAKEFRAG
212 $(res_stampfile):
213         touch $@
214 endif
215
216 # corlib_test
217
218 $(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
219         $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
220
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) >$@
225 else
226         @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
227 endif
228
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 \$$@" >>$@
236         @rm -rf $@.new
237
238 -include $(test_makefrag)
239
240 ifndef HAVE_TEST_MAKEFRAG
241 $(test_stampfile):
242         touch $@
243 endif
244
245 # corlib_plattest
246
247 $(plattestlib): $(plattest_makefrag) $(plattest_response) $(plattest_stampfile)
248         $(CSCOMPILE) $(plattest_flags) /target:library /out:$@ @$(plattest_response)
249
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) >$@
255 else
256         @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
257 endif
258 else
259 ifdef PLATFORM_MONO_NATIVE
260         @cat $(plattest_excludes) $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
261 else
262         @cat $(test_sourcefile) |sort |uniq -u |sed -e 's,^\(.\),Test/\1,' >$@
263 endif
264 endif
265
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 \$$@" >>$@
273         @rm -rf $@.new
274
275 -include $(plattest_makefrag)
276
277 ifndef HAVE_PLATTEST_MAKEFRAG
278 $(plattest_stampfile):
279         touch $@
280 endif