build:
[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 corlib = $(topdir)/class/lib/corlib.dll
11 testlib = corlib_test.dll
12 cmplib = $(topdir)/class/lib/corlib_cmp.dll
13
14 corpdb = $(patsubst %.dll,%.pdb,$(corlib))
15 testpdb = $(patsubst %.dll,%.pdb,$(testlib))
16 cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
17
18 sourcefile = corlib.dll.sources
19 response = $(depsdir)/corlib.dll.response
20 makefrag = $(depsdir)/corlib.dll.makefrag
21 stampfile = $(depsdir)/corlib.dll.stamp
22 # disable, until people fix their code...
23 #corlib_flags = /unsafe /nostdlib /d:INSIDE_CORLIB
24 corlib_flags = /unsafe /nostdlib
25
26 test_sourcefile = corlib_test.dll.sources
27 test_response = $(depsdir)/$(testlib).response
28 test_makefrag = $(depsdir)/$(testlib).makefrag
29 test_stampfile = $(depsdir)/$(testlib).stamp
30 test_flags = /nowarn:0618 /nowarn:0672 /r:$(corlib) /r:$(topdir)/class/lib/NUnit.Framework.dll
31
32 cmp_response = $(depsdir)/corlib_cmp.dll.response
33 cmp_makefrag = $(depsdir)/corlib_cmp.dll.makefrag
34 cmp_stampfile = $(depsdir)/corlib_cmp.dll.stamp
35 cmp_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
36
37 # Here, we make all.
38
39 all-local: $(corlib)
40
41 install-local: $(corlib)
42         $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib
43         $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib
44
45 clean-local:
46         -rm -f $(corlib) $(cmplib) $(testlib) TestResult.xml \
47                $(response) $(makefrag) $(stampfile) \
48                $(test_response) $(test_makefrag) $(test_stampfile) \
49                $(corpdb) $(cmppdb) $(testpdb) \
50                $(cmp_response) $(cmp_makefrag) $(cmp_stampfile)
51
52
53 test-local: $(corlib) $(testlib)
54
55 run-test-local:
56         $(TEST_RUNTIME) $(TEST_HARNESS) $(testlib)
57
58 # OK, that was the easy part. Now we get to the fun bits.
59 #
60 # first, make dist.
61
62 DISTFILES = $(sourcefile) $(test_sourcefile) \
63         corlib.dll.win32-excludes corlib_cmp.dll.excludes Test/ms_run_test.sh
64
65 # see $(topdir)/build/library.make for explanation of what's going on
66 # here.
67
68 dist-local: dist-default
69         for f in `cat $(sourcefile)` `cat $(test_sourcefile) |sed -e 's,^\(.\),Test/\1,'` ; do \
70             dest=`dirname $(distdir)/$$f` ; \
71             $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
72         done
73
74 # plain ol corlib
75
76 $(corlib): $(makefrag) $(response) $(stampfile)
77         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(corlib_flags) /target:library /out:$@ @$(response)
78
79 $(response): $(sourcefile)
80         @echo Creating $@ ...
81 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
82         @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
83 else
84         @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
85 endif
86
87 $(makefrag): $(response)
88         @echo Creating $@ ...
89         @echo "HAVE_MAKEFRAG = yes" >$@.new
90         @echo "$(stampfile): \\" >>$@.new
91         @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
92         @cat $@.new |sed -e '$$s, \\$$,,' >$@
93         @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
94         @rm -rf $@.new
95
96 -include $(makefrag)
97
98 ifndef HAVE_MAKEFRAG
99 $(stampfile):
100         touch $@
101 endif
102
103 # corlib_cmp
104
105 $(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
106         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
107
108 $(cmp_response): $(response) corlib_cmp.dll.excludes
109         @echo Creating $@ ...
110 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
111         @cat corlib_cmp.dll.excludes |$(PLATFORM_CHANGE_SEPARATOR_CMD) |cat - $< |sort |uniq -u >$@
112 else
113         @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
114 endif
115
116 $(cmp_makefrag): $(cmp_response)
117         @echo Creating $@ ...
118         @echo "HAVE_CMP_MAKEFRAG = yes" >$@.new
119         @echo "$(cmp_stampfile): \\" >>$@.new
120         @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
121         @cat $@.new |sed -e '$$s, \\$$,,' >$@
122         @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
123         @rm -rf $@.new
124
125 # Since we make corlib_cmp on demand, there isn't a real need
126 # to have full dep tracking for it. Also, the generation of this
127 # file is busted on Win32 ('sort' seems to mess up line endings),
128 # leading to a broken build.
129 #
130 # -include $(cmp_makefrag)
131
132 ifndef HAVE_CMP_MAKEFRAG
133 $(cmp_stampfile):
134         touch $@
135 endif
136
137 # corlib_test
138
139 $(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
140         $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
141
142 $(test_response): $(test_sourcefile)
143         @echo Creating $@ ...
144 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
145         @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
146 else
147         @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
148 endif
149
150 $(test_makefrag): $(test_response)
151         @echo Creating $@ ...
152         @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new
153         @echo "$(test_stampfile): \\" >>$@.new
154         @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
155         @cat $@.new |sed -e '$$s, \\$$,,' >$@
156         @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
157         @rm -rf $@.new
158
159 -include $(test_makefrag)
160
161 ifndef HAVE_TEST_MAKEFRAG
162 $(test_stampfile):
163         touch $@
164 endif