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