(mono-do-testjit): New target, unused for now. Runs
[mono.git] / Makefile.am
1 AUTOMAKE_OPTIONS = foreign
2 ACLOCAL_AMFLAGS = -I .
3
4 SUBDIRS = $(libgc_dir) mono $(ikvm_jni_dir) docs data runtime scripts man samples support web 
5
6 # Keep in sync with SUBDIRS
7 ## 'tools' is not normally built
8 DIST_SUBDIRS = libgc mono ikvm-jni docs data runtime scripts man samples support web tools
9
10 EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
11
12 pkgconfigdir = $(libdir)/pkgconfig
13 if JIT_SUPPORTED
14 pkgconfig_DATA= mono.pc mint.pc
15 else
16 pkgconfig_DATA= mint.pc
17 endif
18 DISTCLEANFILES= mono.pc mint.pc
19
20 #
21 # The following targets are used to compile and install
22 # mono and mcs without running into the out-of-sync
23 # problems by doing the compilation in the right order.
24 #
25
26 mcs_topdir=$(top_srcdir)/../mcs
27
28 .PHONY: bootstrap faststrap fasterstrap bootstrap-clean bootstrap-check get-monolite-latest monolite-bootstrap
29 .PHONY: tmpinst-dir tmpinst-mcs-basic-build tmpinst-mcs-short-build tmpinst-mcs-full-build tmpinst-monolite
30 .PHONY: mono-do-runtime-only mcs-do-basic-build mcs-do-short-build mcs-do-full-build mcs-do-clean-profiles mcs-do-run-test
31 .PHONY: populate-runtime-subdir
32
33 if USE_JIT
34 mono_runtime = mono/mini/mono
35 else
36 mono_runtime = mono/interpreter/mint
37 endif
38
39 # Minimal set of directories to build, and files used to run the 'mcs' compiler
40 MCS_BASIC_DIRS = jay mcs class/corlib class/System
41 MCS_BASIC_FILES = \
42         $(mcs_topdir)/mcs/mcs.exe \
43         $(mcs_topdir)/class/lib/default/mscorlib.dll \
44         $(mcs_topdir)/class/lib/default/System.dll
45
46 # Set of directories and files the 'mcs' compiler can use
47 ## We build class/System twice to resolve the cyclic dependency of class/System.XML
48 MCS_DIRS = $(MCS_BASIC_DIRS) class/System.XML class/System class/Mono.CSharp.Debugger
49 MCS_FILES = $(MCS_BASIC_FILES) \
50         $(mcs_topdir)/class/lib/default/System.Xml.dll \
51         $(mcs_topdir)/class/lib/default/Mono.CompilerServices.SymbolWriter.dll
52
53 tmpinst = _tmpinst
54
55 if PLATFORM_WIN32
56
57 populate_profiles = default:net_1_1
58
59 # bootstraps using the .NET C# compiler
60 bootstrap: tmpinst-dir mono-do-runtime-only
61         $(MAKE) fasterstrap
62
63 else
64
65 populate_profiles = default:net_1_1 net_2_0:net_2_0
66
67 bootstrap: tmpinst-mcs-basic-build mono-do-runtime-only
68         $(MAKE) tmpinst-mcs-short-build
69         $(MAKE) fasterstrap
70
71 endif
72
73 faststrap: tmpinst-mcs-short-build
74         $(MAKE) mono-do-runtime-only
75         $(MAKE) fasterstrap
76
77 fasterstrap: tmpinst-mcs-full-build
78         $(MAKE) populate-runtime-subdir
79         $(MAKE)
80
81 bootstrap-clean: clean mcs-do-clean-profiles
82
83 bootstrap-check: check mcs-do-run-test-profiles #mono-do-testjit
84
85 mono-do-testjit: $(tmpinst)/bin/ilasm
86         tmpinst=`cd $(tmpinst) && pwd` ; \
87         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
88         cd mono/tests && $(MAKE) test
89
90 # building with monolite
91
92 get-monolite-latest:
93         wget -O $(srcdir)/../monolite-latest.tar.gz http://www.go-mono.com/daily/monolite-latest.tar.gz
94
95 monolite-bootstrap: tmpinst-monolite mono-do-runtime-only
96         rm -f $(MCS_FILES)
97         $(MAKE) tmpinst-mcs-short-build
98         $(MAKE) fasterstrap
99
100 bootstrap-world:
101         $(MAKE) bootstrap-clean
102         $(MAKE) bootstrap
103         $(MAKE) install
104         $(MAKE) mcs-do-compiler-tests
105
106 # internal targets
107
108 tmpinst-mcs-basic-build: mcs-do-basic-build tmpinst-dir
109         mv -f $(MCS_BASIC_FILES) $(tmpinst)/lib
110
111 tmpinst-mcs-short-build: mcs-do-short-build tmpinst-dir
112         mv -f $(MCS_FILES) $(tmpinst)/lib
113
114 tmpinst-mcs-full-build: mcs-do-full-build tmpinst-dir
115         cp -f $(MCS_FILES) $(tmpinst)/lib
116
117 tmpinst-monolite: tmpinst-dir
118         -rm -f $(tmpinst)/lib/mcs.exe $(tmpinst)/lib/*.dll
119         -rm -fr $(tmpinst)/monolite-*
120         srcdir=`cd $(srcdir) && pwd` && cd $(tmpinst) && ( gzip -d -c $$srcdir/../monolite-latest.tar.gz | tar xf - )
121         mv -f $(tmpinst)/monolite-*/mcs.exe $(tmpinst)/monolite-*/*.dll $(tmpinst)/lib
122         rm -fr $(tmpinst)/monolite-*
123
124 # Build enough of 'mono' to run the stage1 mcs.exe
125 mono-do-runtime-only: $(CONFIG_HEADER)
126         for dir in $(libgc_dir) mono data; do \
127           (cd $$dir && $(MAKE)) || exit 1 ; \
128         done
129
130 mcs-do-basic-build:
131         rm -f $(MCS_FILES)
132         for dir in $(MCS_BASIC_DIRS); do \
133           (cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default NO_SIGN_ASSEMBLY=yes USE_BOOT_COMPILE=yes BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB") || exit 1 ; \
134         done
135
136 mcs-do-short-build:
137         tmpinst=`cd $(tmpinst) && pwd` ; \
138         PATH=$$tmpinst/bin:$$PATH; export PATH ; \
139         for dir in $(MCS_DIRS); do \
140           (cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default NO_SIGN_ASSEMBLY=yes) || exit 1 ; \
141         done
142
143 mcs-do-full-build:
144         tmpinst=`cd $(tmpinst) && pwd` ; \
145         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
146         cd $(mcs_topdir) && $(MAKE) NO_SIGN_ASSEMBLY=yes all-profiles
147
148 mcs-do-clean-profiles:
149         cd $(mcs_topdir) && $(MAKE) clean-profiles
150
151 mcs-do-run-test-profiles: tmpinst-dir $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm
152         tmpinst=`cd $(tmpinst) && pwd` ; \
153         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
154         cd $(mcs_topdir) && $(MAKE) run-test-profiles
155
156 mcs-do-compiler-tests:
157         tmpinst=`cd $(tmpinst) && pwd` ; \
158         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
159         cd $(mcs_topdir) && $(MAKE) compiler-tests
160
161 populate-runtime-subdir:
162         test -n '$(populate_profiles)'
163         @srcdir=`cd $(srcdir) && pwd`; tmpinst=`pwd`/$(tmpinst) ; \
164         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
165         for profile in $(populate_profiles); do \
166           ( set fnord `echo $$profile | sed 's,:, ,g'` && \
167             echo "cd $(mcs_topdir) && $(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime PROFILE=$$2 LIBRARY_INSTALL_DIR=$$srcdir/runtime/$$3 prefix=$$tmpinst/prefix install" && \
168             cd $(mcs_topdir) && \
169             $(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime PROFILE=$$2 LIBRARY_INSTALL_DIR=$$srcdir/runtime/$$3 prefix=$$tmpinst/prefix install ) || exit 1 ; \
170         done
171         find $(tmpinst)/prefix -type f -name '*jay*' -exec rm -f '{}' ';'
172         for i in `find $(tmpinst)/prefix -type d -name '*jay*' -print`; do rm -f $$i/*; done
173         test -z "`find $(tmpinst)/prefix -type f -print`"
174         rm -rf $(tmpinst)/prefix
175
176 tmpinst-dir: 
177         mkdir -p $(tmpinst) $(tmpinst)/bin $(tmpinst)/lib $(tmpinst)/etc/mono/1.0 $(tmpinst)/etc/mono/2.0
178         $(MAKE) tmpinst-dir-contents
179
180 tmpinst-dir-contents: $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/etc/mono/1.0/machine.config $(tmpinst)/etc/mono/2.0/machine.config
181
182 if PLATFORM_WIN32
183
184 $(tmpinst)/bin/mono: $(srcdir)/Makefile.am
185         echo '#! /bin/sh' > $@
186         echo 'builddir="'`pwd`'"; win_builddir="'`cygpath -w -a .`'"' >> $@
187         echo 'tmpinst="$$win_builddir\\$(tmpinst)"' >> $@
188         echo 'if test -z "$$MONO_PATH" ; then MONO_PATH="$$tmpinst\\lib"; else MONO_PATH="$${MONO_PATH};$$tmpinst\\lib" ; fi' >> $@
189         echo 'MONO_CFG_DIR="$$tmpinst\\etc"' >> $@
190         echo 'export MONO_PATH MONO_CFG_DIR' >> $@
191         echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/$(mono_runtime).exe" "$$@"' >> $@
192         chmod +x $@
193
194 else
195
196 $(tmpinst)/bin/mono: $(srcdir)/Makefile.am
197         echo '#! /bin/sh' > $@
198         echo 'builddir="'`pwd`'"; tmpinst=$$builddir/$(tmpinst)' >> $@
199         echo 'if test -z "$$MONO_PATH" ; then MONO_PATH=$$tmpinst/lib; else MONO_PATH=$${MONO_PATH}:$$tmpinst/lib ; fi' >> $@
200         echo 'MONO_CFG_DIR=$$tmpinst/etc' >> $@
201         echo 'export MONO_PATH MONO_CFG_DIR' >> $@
202         echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/$(mono_runtime)" --config "$$builddir/data/config" "$$@"' >> $@
203         chmod +x $@
204
205 endif
206
207 $(tmpinst)/bin/mcs: $(srcdir)/Makefile.am
208         (t=`cd $(tmpinst) && pwd`; echo '#! /bin/sh'; echo 'exec "'"$$t/bin/mono"'" "'"$$t/lib/mcs.exe"'" "$$@"') > $@
209         chmod +x $@
210
211 # Used only by 'bootstrap-check' -- so, can safely use runtime/.
212 $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm: $(srcdir)/Makefile.am
213         t=`cd $(tmpinst) && pwd`; r=`cd $(srcdir)/runtime && pwd`; \
214         ( echo '#! /bin/sh'; echo 'exec "'"$$t/bin/mono"'" "'"$$r/$(@F).exe"'" "$$@"' ) > $@
215         chmod +x $@
216
217 $(tmpinst)/etc/mono/1.0/machine.config: $(srcdir)/data/net_1_1/machine.config
218         rm -f $@
219         srcdir=`cd $(srcdir) && pwd`; cd $(tmpinst)/etc/mono/1.0 && $(LN_S) $$srcdir/data/net_1_1/machine.config machine.config
220
221 $(tmpinst)/etc/mono/2.0/machine.config: $(srcdir)/data/net_2_0/machine.config
222         rm -f $@
223         srcdir=`cd $(srcdir) && pwd`; cd $(tmpinst)/etc/mono/2.0 && $(LN_S) $$srcdir/data/net_2_0/machine.config machine.config
224
225 # Obsolete target -- don't use.
226 .PHONY: fullbuild
227 fullbuild: bootstrap
228         $(MAKE) install
229         echo "*** 'fullbuild' is an obsolete target. Use 'make bootstrap && make install'."
230         exit 1
231
232 win32getdeps:
233         wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
234         wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip 
235         wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip 
236         wget http://www.go-mono.com/archive/libiconv-1.7.zip 
237         wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip 
238         wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
239         wget http://www.jroith.de/nsis4cygwin.zip
240         unzip -n -d / pkgconfig-0.11-20020310.zip
241         unzip -n -d / glib-2.0.4-20020703.zip
242         unzip -n -d / glib-dev-2.0.4-20020703.zip
243         unzip -n -d / libiconv-1.7.zip
244         unzip -n -d / libiconv-dev-1.7.zip
245         unzip -n -d / libintl-0.10.40-20020101.zip
246         unzip -n -d / nsis4cygwin.zip
247
248 win32setup:
249         makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi