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