2004-11-22 Raja R Harinath <rharinath@novell.com>
[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
56 profile-do--net_2_0--all: profile-do--net_2_0_bootstrap--all
57 profile-do--net_2_0_bootstrap--all: profile-do--default--all
58
59 ifeq (linux, $(PLATFORM))
60 profile-do--default--all: profile-do--net_1_1_bootstrap--all
61 profile-do--net_1_1_bootstrap--all: profile-do--basic--all
62 endif
63
64 testcorlib:
65         @cd class/corlib && $(MAKE) test run-test
66
67 compiler-tests:
68         $(MAKE) TEST_SUBDIRS="tests errors" run-test-profiles
69
70 test-installed-compiler:
71         $(MAKE) TEST_SUBDIRS="tests errors" PROFILE=default TEST_RUNTIME=mono MCS=mcs run-test
72         $(MAKE) TEST_SUBDIRS="tests errors" PROFILE=net_2_0 TEST_RUNTIME=mono MCS=gmcs run-test
73
74 package := mcs-$(VERSION)
75
76 DISTFILES = \
77         AUTHORS                 \
78         ChangeLog               \
79         COPYING                 \
80         COPYING.LIB             \
81         INSTALL.txt             \
82         LICENSE                 \
83         LICENSE.GPL             \
84         LICENSE.LGPL            \
85         Makefile                \
86         mkinstalldirs           \
87         MIT.X11                 \
88         MonoIcon.png            \
89         README                  \
90         ScalableMonoIcon.svg    \
91         winexe.in
92
93 dist-local: dist-default
94
95 dist-pre:
96         rm -rf $(package)
97         mkdir $(package)
98
99 dist-tarball: dist-pre
100         $(MAKE) distdir='$(package)' dist-recursive
101         tar cvzf $(package).tar.gz $(package)
102
103 dist: dist-tarball
104         rm -rf $(package)
105
106 # the egrep -v is kind of a hack (to get rid of the makefrags)
107 # but otherwise we have to make dist then make clean which
108 # is sort of not kosher. And it breaks with DIST_ONLY_SUBDIRS.
109 #
110 # We need to set prefix on make so class/System/Makefile can find
111 # the installed System.Xml to build properly
112
113 distcheck: dist-tarball
114         rm -rf InstallTest Distcheck-MCS ; \
115         mkdir InstallTest ; \
116         destdir=`cd InstallTest && pwd` ; \
117         mv $(package) Distcheck-MCS ; \
118         (cd Distcheck-MCS && \
119             $(MAKE) prefix=$(prefix) && $(MAKE) test && $(MAKE) install DESTDIR="$$destdir" && \
120             $(MAKE) clean && $(MAKE) dist || exit 1) || exit 1 ; \
121         mv Distcheck-MCS $(package) ; \
122         tar tzf $(package)/$(package).tar.gz |sed -e 's,/$$,,' |sort >distdist.list ; \
123         rm $(package)/$(package).tar.gz ; \
124         tar tzf $(package).tar.gz |sed -e 's,/$$,,' |sort >before.list ; \
125         find $(package) |egrep -v '(makefrag|response)' |sed -e 's,/$$,,' |sort >after.list ; \
126         cmp before.list after.list || exit 1 ; \
127         cmp before.list distdist.list || exit 1 ; \
128         rm -f before.list after.list distdist.list ; \
129         rm -rf $(package) InstallTest
130
131 monocharge:
132         chargedir=monocharge-`date -u +%Y%m%d` ; \
133         mkdir "$$chargedir" ; \
134         DESTDIR=`cd "$$chargedir" && pwd` ; \
135         $(MAKE) install DESTDIR="$$DESTDIR" || exit 1 ; \
136         tar cvzf "$$chargedir".tgz "$$chargedir" ; \
137         rm -rf "$$chargedir"
138
139 # A bare-bones monocharge.
140
141 monocharge-lite:
142         chargedir=monocharge-lite-`date -u +%Y%m%d` ; \
143         mkdir "$$chargedir" ; \
144         DESTDIR=`cd "$$chargedir" && pwd` ; \
145         $(MAKE) -C mcs install DESTDIR="$$DESTDIR" || exit 1; \
146         $(MAKE) -C class/corlib install DESTDIR="$$DESTDIR" || exit 1; \
147         $(MAKE) -C class/System install DESTDIR="$$DESTDIR" || exit 1; \
148         $(MAKE) -C class/System.XML install DESTDIR="$$DESTDIR" || exit 1; \
149         $(MAKE) -C class/Mono.CSharp.Debugger install DESTDIR="$$DESTDIR" || exit 1; \
150         tar cvzf "$$chargedir".tgz "$$chargedir" ; \
151         rm -rf "$$chargedir"