2004-06-10 Atsushi Enomoto <atsushi@ximian.com>
[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 bootstrap: tmpinst-mcs-basic-build mono-do-runtime-only
52         $(MAKE) tmpinst-mcs-short-build
53         $(MAKE) fasterstrap
54
55 faststrap: tmpinst-mcs-short-build
56         $(MAKE) mono-do-runtime-only
57         $(MAKE) fasterstrap
58
59 fasterstrap: tmpinst-mcs-full-build
60         rm -f $(top_srcdir)/runtime/*/*.dll $(top_srcdir)/runtime/*.exe
61         $(MAKE)
62
63 bootstrap-clean: clean mcs-do-clean-profiles
64 bootstrap-check: check mcs-do-run-test
65
66 # building with monolite
67
68 get-monolite-latest:
69         wget -O $(srcdir)/../monolite-latest.tar.gz http://www.go-mono.com/daily/monolite-latest.tar.gz
70
71 monolite-bootstrap: tmpinst-monolite mono-do-runtime-only
72         rm -f $(MCS_FILES)
73         $(MAKE) tmpinst-mcs-short-build
74         $(MAKE) fasterstrap
75
76 # internal targets
77
78 tmpinst-mcs-basic-build: mcs-do-basic-build tmpinst-dir
79         mv -f $(MCS_BASIC_FILES) _tmpinst/lib
80
81 tmpinst-mcs-short-build: mcs-do-short-build
82         mv -f $(MCS_FILES) _tmpinst/lib
83
84 tmpinst-mcs-full-build: mcs-do-full-build
85         cp -f $(MCS_FILES) _tmpinst/lib
86
87 tmpinst-monolite: tmpinst-dir
88         -rm -f _tmpinst/lib/mcs.exe _tmpinst/lib/*.dll
89         -rm -fr _tmpinst/monolite-*
90         srcdir=`cd $(srcdir) && pwd` && cd _tmpinst && ( gzip -d -c $$srcdir/../monolite-latest.tar.gz | tar xf - )
91         mv -f _tmpinst/monolite-*/mcs.exe _tmpinst/monolite-*/*.dll _tmpinst/lib
92         rm -fr _tmpinst/monolite-*
93
94 # Build enough of 'mono' to run the stage1 mcs.exe
95 mono-do-runtime-only: $(CONFIG_HEADER)
96         if test -z "$(libgc_dir)"; then :; else cd libgc && $(MAKE) ; fi
97         cd mono && $(MAKE)
98
99 mcs-do-basic-build:
100         rm -f $(MCS_FILES)
101         for dir in $(MCS_BASIC_DIRS); do \
102           (cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB") || exit 1 ; \
103         done
104
105 mcs-do-short-build:
106         tmpinst=`cd _tmpinst && pwd` ; \
107         PATH=$$tmpinst/bin:$$PATH; export PATH ; \
108         for dir in $(MCS_DIRS); do \
109           (cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default) || exit 1 ; \
110         done
111
112 mcs-do-full-build:
113         tmpinst=`cd _tmpinst && pwd` ; \
114         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
115         cd $(mcs_topdir) && $(MAKE) all-profiles
116
117 mcs-do-clean-profiles:
118         cd $(mcs_topdir) && $(MAKE) clean-profiles
119
120 mcs-do-run-test: tmpinst-dir
121         tmpinst=`cd _tmpinst && pwd` ; \
122         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
123         cd $(mcs_topdir) && $(MAKE) PROFILE=default run-test
124
125 tmpinst-dir.stamp: Makefile.am
126         set -e ; \
127         rootme=`pwd`; tmpinst=$$rootme/_tmpinst ; \
128         mkdir -p $$tmpinst $$tmpinst/bin $$tmpinst/lib ; \
129         echo '#! /bin/sh' > $$tmpinst/bin/mono ; \
130         echo 'if test -z "$$MONO_PATH" ; then MONO_PATH="'"$$tmpinst/lib"'"' >> $$tmpinst/bin/mono ; \
131         echo 'else MONO_PATH=$${MONO_PATH}:"'"$$tmpinst/lib"'" ; fi' >> $$tmpinst/bin/mono ; \
132         echo 'export MONO_PATH' >> $$tmpinst/bin/mono ; \
133         echo 'exec "'"$$rootme/libtool"'" --mode=execute "'"$$rootme/$(mono_runtime)"'" "$$@"' >> $$tmpinst/bin/mono ; \
134         echo '#! /bin/sh' > $$tmpinst/bin/mcs ; \
135         echo 'exec "'"$$tmpinst/bin/mono"'" "'"$$tmpinst/lib/mcs.exe"'" "$$@"' >> $$tmpinst/bin/mcs ; \
136         chmod +x $$tmpinst/bin/mono $$tmpinst/bin/mcs
137         echo "stamp" > $@
138
139 tmpinst-dir: tmpinst-dir.stamp
140         @if test -d _tmpinst; then :; else rm -f tmpinst-dir.stamp; $(MAKE) tmpinst-dir.stamp; fi
141
142 # Obsolete target -- don't use.
143 .PHONY: fullbuild
144 fullbuild: bootstrap
145         $(MAKE) install
146         echo "*** 'fullbuild' is an obsolete target. Use 'make bootstrap && make install'."
147         exit 1
148
149 win32getdeps:
150         wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
151         wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip 
152         wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip 
153         wget http://www.go-mono.com/archive/libiconv-1.7.zip 
154         wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip 
155         wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
156         wget http://www.jroith.de/nsis4cygwin.zip
157         unzip -n -d / pkgconfig-0.11-20020310.zip
158         unzip -n -d / glib-2.0.4-20020703.zip
159         unzip -n -d / glib-dev-2.0.4-20020703.zip
160         unzip -n -d / libiconv-1.7.zip
161         unzip -n -d / libiconv-dev-1.7.zip
162         unzip -n -d / libintl-0.10.40-20020101.zip
163         unzip -n -d / nsis4cygwin.zip
164
165 win32setup:
166         makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi