Improve coarse-grain parallelism in the build
[mono.git] / mcs / Makefile
1 thisdir := .
2
3 SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs
4
5 basic_SUBDIRS := build jay mcs class
6 net_1_1_bootstrap_SUBDIRS := build jay mcs class ilasm tools
7 net_2_0_bootstrap_SUBDIRS := build jay mcs class ilasm tools
8 net_2_0_SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs
9 net_2_1_bootstrap_SUBDIRS := build mcs class
10 net_2_1_raw_SUBDIRS := build mcs class tools
11 net_2_1_SUBDIRS := tools tests errors
12 net_3_5_SUBDIRS := build class
13 net_4_0_bootstrap_SUBDIRS := build mcs class tools
14 net_4_0_SUBDIRS := build mcs class nunit24 ilasm tools tests errors
15
16 # List of test subdirs that should pass 100%
17 centum_tests := \
18         class/corlib                                            \
19         class/System                                            \
20         class/System.XML                                        \
21         class/Commons.Xml.Relaxng                               \
22         class/Cscompmgd                                         \
23         class/Microsoft.JScript                                 \
24         class/Mono.Posix                                        \
25         class/Mono.Security                                     \
26         class/System.Design                                     \
27         class/System.DirectoryServices          \
28         class/System.Drawing                            \
29         class/System.Runtime.Remoting                           \
30         class/System.Runtime.Serialization.Formatters.Soap      \
31         class/System.Security                                   \
32         class/System.ServiceProcess                             \
33         class/System.Web                                                \
34         class/System.Web.Services                               \
35         tests                                                   \
36         errors
37
38 default_centum_tests := \
39         $(centum_tests)         \
40         class/System.Data
41
42 net_2_0_centum_tests := \
43         $(centum_tests)                         \
44         class/System.Core                       \
45         class/System.Configuration              \
46         class/System.Data.DataSetExtensions     \
47         class/System.Xml.Linq                   \
48         class/System.Transactions               \
49         class/Microsoft.Build.Framework         \
50         class/Microsoft.Build.Utilities         \
51         class/Microsoft.Build.Engine            \
52         class/Mono.C5
53
54 #       class/System.Web.Extensions
55 #       class/Microsoft.Build.Tasks     
56
57 # note that System.Xml.Linq is here to prevent this from being empty
58 net_3_5_centum_tests := \
59         class/System.Xml.Linq
60
61 ifdef ONLY_CENTUM_TESTS
62 TEST_SUBDIRS := $($(PROFILE)_centum_tests)
63 endif
64
65 ifdef TEST_SUBDIRS
66 $(PROFILE)_SUBDIRS := $(TEST_SUBDIRS)
67 endif
68
69 include build/rules.make
70
71 all-recursive $(STD_TARGETS:=-recursive): dir-check platform-check profile-check
72
73 .PHONY: all-local $(STD_TARGETS:=-local)
74 all-local $(STD_TARGETS:=-local):
75         @:
76
77 dir-check:
78         @if [ "$(NO_DIR_CHECK)" = "" -a "$(PROFILE)" != "basic" ]; then echo "Running make from the mcs directory is not supported. Run make from the parent directory (if using a tarball), or from the directory where the runtime is checked out (if using an SVN checkout)."; exit 1; fi
79
80 # fun specialty targets
81
82 PROFILES = net_1_1 net_2_0 net_3_5 net_4_0
83
84 .PHONY: all-profiles $(STD_TARGETS:=-profiles)
85 all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
86         @:
87
88 profiles-do--%:
89         $(MAKE) $(PROFILES:%=profile-do--%--$*)
90
91 # The % below looks like profile-name--target-name
92 profile-do--%:
93         $(MAKE) PROFILE=$(subst --, ,$*)
94
95 # We don't want to run the tests in parallel.  We want behaviour like -k.
96 profiles-do--run-test:
97         ret=:; $(foreach p,$(PROFILES), { $(MAKE) PROFILE=$(p) run-test || ret=false; }; ) $$ret
98
99 # Orchestrate the bootstrap here.
100 _boot_ = all clean install
101 $(_boot_:%=profile-do--net_4_0--%):           profile-do--net_4_0--%:           profile-do--net_4_0_bootstrap--%
102 $(_boot_:%=profile-do--net_4_0_bootstrap--%): profile-do--net_4_0_bootstrap--%: profile-do--net_2_0--%
103 $(_boot_:%=profile-do--net_3_5--%):           profile-do--net_3_5--%:           profile-do--net_2_0--%
104 $(_boot_:%=profile-do--net_2_1--%):           profile-do--net_2_1--%:           profile-do--net_2_1_raw--%
105 $(_boot_:%=profile-do--net_2_1_raw--%):       profile-do--net_2_1_raw--%:       profile-do--net_2_1_bootstrap--%
106 $(_boot_:%=profile-do--net_2_1_bootstrap--%): profile-do--net_2_1_bootstrap--%: profile-do--net_2_0--%
107 $(_boot_:%=profile-do--net_2_0--%):           profile-do--net_2_0--%:           profile-do--net_2_0_bootstrap--%
108 $(_boot_:%=profile-do--net_2_0_bootstrap--%): profile-do--net_2_0_bootstrap--%: profile-do--net_1_1_bootstrap--%
109 $(_boot_:%=profile-do--net_1_1--%):           profile-do--net_1_1--%:           profile-do--net_1_1_bootstrap--%
110 $(_boot_:%=profile-do--net_1_1_bootstrap--%): profile-do--net_1_1_bootstrap--%: profile-do--basic--%
111
112 testcorlib:
113         @cd class/corlib && $(MAKE) test run-test
114
115 compiler-tests:
116         $(MAKE) TEST_SUBDIRS="tests errors" run-test-profiles
117
118 test-installed-compiler:
119         $(MAKE) TEST_SUBDIRS="tests errors" PROFILE=net_1_1 TEST_RUNTIME=mono MCS=mcs run-test
120         $(MAKE) TEST_SUBDIRS="tests errors" PROFILE=net_2_0 TEST_RUNTIME=mono MCS=gmcs run-test
121
122 package := mcs-$(VERSION)
123
124 DISTFILES = \
125         AUTHORS                 \
126         ChangeLog               \
127         COPYING                 \
128         COPYING.LIB             \
129         INSTALL.txt             \
130         LICENSE                 \
131         LICENSE.GPL             \
132         LICENSE.LGPL            \
133         LICENSE.MPL             \
134         Makefile                \
135         mkinstalldirs           \
136         MIT.X11                 \
137         MonoIcon.png            \
138         README                  \
139         ScalableMonoIcon.svg    \
140         winexe.in               \
141         nunit.key
142
143 dist-local: dist-default
144
145 dist-pre:
146         rm -rf $(package)
147         mkdir $(package)
148
149 dist-tarball: dist-pre
150         $(MAKE) distdir='$(package)' dist-recursive
151         tar cvjf $(package).tar.bz2 $(package)
152
153 dist: dist-tarball
154         rm -rf $(package)
155
156 # the egrep -v is kind of a hack (to get rid of the makefrags)
157 # but otherwise we have to make dist then make clean which
158 # is sort of not kosher. And it breaks with DIST_ONLY_SUBDIRS.
159 #
160 # We need to set prefix on make so class/System/Makefile can find
161 # the installed System.Xml to build properly
162
163 distcheck: dist-tarball
164         rm -rf InstallTest Distcheck-MCS ; \
165         mkdir InstallTest ; \
166         destdir=`cd InstallTest && pwd` ; \
167         mv $(package) Distcheck-MCS ; \
168         (cd Distcheck-MCS && \
169             $(MAKE) prefix=$(prefix) && $(MAKE) test && $(MAKE) install DESTDIR="$$destdir" && \
170             $(MAKE) clean && $(MAKE) dist || exit 1) || exit 1 ; \
171         mv Distcheck-MCS $(package) ; \
172         tar tjf $(package)/$(package).tar.bz2 |sed -e 's,/$$,,' |sort >distdist.list ; \
173         rm $(package)/$(package).tar.bz2 ; \
174         tar tjf $(package).tar.bz2 |sed -e 's,/$$,,' |sort >before.list ; \
175         find $(package) |egrep -v '(makefrag|response)' |sed -e 's,/$$,,' |sort >after.list ; \
176         cmp before.list after.list || exit 1 ; \
177         cmp before.list distdist.list || exit 1 ; \
178         rm -f before.list after.list distdist.list ; \
179         rm -rf $(package) InstallTest
180
181 monocharge:
182         chargedir=monocharge-`date -u +%Y%m%d` ; \
183         mkdir "$$chargedir" ; \
184         DESTDIR=`cd "$$chargedir" && pwd` ; \
185         $(MAKE) install DESTDIR="$$DESTDIR" || exit 1 ; \
186         tar cvjf "$$chargedir".tar.bz2 "$$chargedir" ; \
187         rm -rf "$$chargedir"
188
189 # A bare-bones monocharge.
190
191 monocharge-lite:
192         chargedir=monocharge-lite-`date -u +%Y%m%d` ; \
193         mkdir "$$chargedir" ; \
194         DESTDIR=`cd "$$chargedir" && pwd` ; \
195         $(MAKE) -C mcs install DESTDIR="$$DESTDIR" || exit 1; \
196         $(MAKE) -C class/corlib install DESTDIR="$$DESTDIR" || exit 1; \
197         $(MAKE) -C class/System install DESTDIR="$$DESTDIR" || exit 1; \
198         $(MAKE) -C class/System.XML install DESTDIR="$$DESTDIR" || exit 1; \
199         $(MAKE) -C class/Mono.CSharp.Debugger install DESTDIR="$$DESTDIR" || exit 1; \
200         tar cvjf "$$chargedir".tar.bz2 "$$chargedir" ; \
201         rm -rf "$$chargedir"