1a457c69f244ebd771cd6495015fbec0718a9068
[mono.git] / Makefile.am
1 AUTOMAKE_OPTIONS = foreign
2
3 SUBDIRS = @libgc_dir@ mono @ikvm_jni_dir@ docs runtime scripts man data samples support web 
4
5 # Keep in sync with SUBDIRS
6 ## 'tools' is not normally built
7 DIST_SUBDIRS = libgc mono ikvm-jni docs runtime scripts man data samples support web tools
8
9 EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
10
11 pkgconfigdir = $(libdir)/pkgconfig
12 if JIT_SUPPORTED
13 pkgconfig_DATA= mono.pc mint.pc
14 else
15 pkgconfig_DATA= mint.pc
16 endif
17 DISTCLEANFILES= mono.pc mint.pc
18
19 #
20 # The following targets are used to compile and install
21 # mono and mcs without running into the out-of-sync
22 # problems by doing the compilation in the right order.
23 #
24
25 mcs_topdir=$(top_srcdir)/../mcs
26
27 .PHONY: bootstrap faststrap fasterstrap bootstrap-clean bootstrap-check get-monolite-latest monolite-bootstrap
28 .PHONY: tmpinst-dir tmpinst-mcs-basic-build tmpinst-mcs-short-build tmpinst-mcs-full-build tmpinst-monolite
29 .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
30
31 if USE_JIT
32 mono_runtime = mono/mini/mono
33 else
34 mono_runtime = mono/interpreter/mint
35 endif
36
37 # Minimal set of directories to build, and files used to run the 'mcs' compiler
38 MCS_BASIC_DIRS = jay mcs class/corlib class/System
39 MCS_BASIC_FILES = \
40         $(mcs_topdir)/mcs/mcs.exe \
41         $(mcs_topdir)/class/lib/default/mscorlib.dll \
42         $(mcs_topdir)/class/lib/default/System.dll
43
44 # Set of directories and files the 'mcs' compiler can use
45 ## We build class/System twice to resolve the cyclic dependency of class/System.XML
46 MCS_DIRS = $(MCS_BASIC_DIRS) class/System.XML class/System class/Mono.CSharp.Debugger
47 MCS_FILES = $(MCS_BASIC_FILES) \
48         $(mcs_topdir)/class/lib/default/System.Xml.dll \
49         $(mcs_topdir)/class/lib/default/Mono.CSharp.Debugger.dll
50
51 tmpinst = _tmpinst
52
53 bootstrap: tmpinst-mcs-basic-build mono-do-runtime-only
54         $(MAKE) tmpinst-mcs-short-build
55         $(MAKE) fasterstrap
56
57 faststrap: tmpinst-mcs-short-build
58         $(MAKE) mono-do-runtime-only
59         $(MAKE) fasterstrap
60
61 fasterstrap: tmpinst-mcs-full-build
62         rm -f $(top_srcdir)/runtime/*/*.dll $(top_srcdir)/runtime/*.exe
63         $(MAKE)
64
65 bootstrap-clean: clean mcs-do-clean-profiles
66 bootstrap-check: check mcs-do-run-test
67
68 # building with monolite
69
70 get-monolite-latest:
71         wget -O $(srcdir)/../monolite-latest.tar.gz http://www.go-mono.com/daily/monolite-latest.tar.gz
72
73 monolite-bootstrap: tmpinst-monolite mono-do-runtime-only
74         rm -f $(MCS_FILES)
75         $(MAKE) tmpinst-mcs-short-build
76         $(MAKE) fasterstrap
77
78 # internal targets
79
80 tmpinst-mcs-basic-build: mcs-do-basic-build tmpinst-dir
81         mv -f $(MCS_BASIC_FILES) $(tmpinst)/lib
82
83 tmpinst-mcs-short-build: mcs-do-short-build
84         mv -f $(MCS_FILES) $(tmpinst)/lib
85
86 tmpinst-mcs-full-build: mcs-do-full-build
87         cp -f $(MCS_FILES) $(tmpinst)/lib
88
89 tmpinst-monolite: tmpinst-dir
90         -rm -f $(tmpinst)/lib/mcs.exe $(tmpinst)/lib/*.dll
91         -rm -fr $(tmpinst)/monolite-*
92         srcdir=`cd $(srcdir) && pwd` && cd $(tmpinst) && ( gzip -d -c $$srcdir/../monolite-latest.tar.gz | tar xf - )
93         mv -f $(tmpinst)/monolite-*/mcs.exe $(tmpinst)/monolite-*/*.dll $(tmpinst)/lib
94         rm -fr $(tmpinst)/monolite-*
95
96 # Build enough of 'mono' to run the stage1 mcs.exe
97 mono-do-runtime-only: $(CONFIG_HEADER)
98         for dir in $(libgc_dir) mono data; do \
99           (cd $$dir && $(MAKE)) || exit 1 ; \
100         done
101
102 mcs-do-basic-build:
103         rm -f $(MCS_FILES)
104         for dir in $(MCS_BASIC_DIRS); do \
105           (cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default USE_BOOT_COMPILE=yes BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB") || exit 1 ; \
106         done
107
108 mcs-do-short-build:
109         tmpinst=`cd $(tmpinst) && pwd` ; \
110         PATH=$$tmpinst/bin:$$PATH; export PATH ; \
111         for dir in $(MCS_DIRS); do \
112           (cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default) || exit 1 ; \
113         done
114
115 mcs-do-full-build:
116         tmpinst=`cd $(tmpinst) && pwd` ; \
117         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
118         cd $(mcs_topdir) && $(MAKE) all-profiles
119
120 mcs-do-clean-profiles:
121         cd $(mcs_topdir) && $(MAKE) clean-profiles
122
123 mcs-do-run-test: tmpinst-dir
124         tmpinst=`cd $(tmpinst) && pwd` ; \
125         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
126         cd $(mcs_topdir) && $(MAKE) PROFILE=default run-test
127
128 tmpinst-dir: 
129         mkdir -p $(tmpinst) $(tmpinst)/bin $(tmpinst)/lib $(tmpinst)/etc/mono
130         $(MAKE) $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/etc/mono/machine.config
131
132 $(tmpinst)/bin/mono: $(srcdir)/Makefile.am
133         echo '#! /bin/sh' > $@
134         echo 'builddir="'`pwd`'"; tmpinst=$$builddir/$(tmpinst)' >> $@
135         echo 'if test -z "$$MONO_PATH" ; then MONO_PATH=$$tmpinst/lib; else MONO_PATH=$${MONO_PATH}:$$tmpinst/lib ; fi' >> $@
136         echo 'MONO_CFG_DIR=$$tmpinst/etc' >> $@
137         echo 'export MONO_PATH MONO_CFG_DIR' >> $@
138         echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/$(mono_runtime)" --config "$$builddir/data/config" "$$@"' >> $@
139         chmod +x $@
140
141 $(tmpinst)/bin/mcs: $(srcdir)/Makefile.am
142         (t=`cd $(tmpinst) && pwd`; echo '#! /bin/sh'; echo 'exec "'"$$t/bin/mono"'" "'"$$t/lib/mcs.exe"'" "$$@"') > $@
143         chmod +x $@
144
145 $(tmpinst)/etc/mono/machine.config: $(srcdir)/data/machine.config
146         rm -f $@
147         srcdir=`cd $(srcdir) && pwd`; cd $(tmpinst)/etc/mono && $(LN_S) $$srcdir/data/machine.config machine.config
148
149 # Obsolete target -- don't use.
150 .PHONY: fullbuild
151 fullbuild: bootstrap
152         $(MAKE) install
153         echo "*** 'fullbuild' is an obsolete target. Use 'make bootstrap && make install'."
154         exit 1
155
156 win32getdeps:
157         wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
158         wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip 
159         wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip 
160         wget http://www.go-mono.com/archive/libiconv-1.7.zip 
161         wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip 
162         wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
163         wget http://www.jroith.de/nsis4cygwin.zip
164         unzip -n -d / pkgconfig-0.11-20020310.zip
165         unzip -n -d / glib-2.0.4-20020703.zip
166         unzip -n -d / glib-dev-2.0.4-20020703.zip
167         unzip -n -d / libiconv-1.7.zip
168         unzip -n -d / libiconv-dev-1.7.zip
169         unzip -n -d / libintl-0.10.40-20020101.zip
170         unzip -n -d / nsis4cygwin.zip
171
172 win32setup:
173         makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi