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