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