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