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