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