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