2004-05-18 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
[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 DIST_SUBDIRS = libgc mono ikvm-jni docs runtime scripts man data samples support web
7
8 EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
9
10 pkgconfigdir = $(libdir)/pkgconfig
11 if JIT_SUPPORTED
12 pkgconfig_DATA= mono.pc mint.pc
13 else
14 pkgconfig_DATA= mint.pc
15 endif
16 DISTCLEANFILES= mono.pc mint.pc
17
18 #
19 # The following target is used to compile and install
20 # mono and mcs without running into the out-of-sync
21 # problems by doing the compilation in the right order.
22 #
23
24 mcs_topdir=$(top_srcdir)/../mcs
25
26 .PHONY: tmpinst-dir tmpinst-runtime bootstrap stage1 stage2 stage3 stage1-mono stage1-mcs bootstrap-clean bootstrap-check
27
28 if USE_JIT
29 mono_runtime = mono/mini/mono
30 else
31 mono_runtime = mono/interpreter/mint
32 endif
33
34 bootstrap: stage3
35         rm -f $(top_srcdir)/runtime/*/*.dll $(top_srcdir)/runtime/*.exe
36         $(MAKE)
37
38 bootstrap-clean: clean mcs-do-clean-profiles
39 bootstrap-check: check mcs-do-run-test
40
41 .PHONY: mcs-do-clean-profiles mcs-do-run-test
42 mcs-do-clean-profiles:
43         cd $(mcs_topdir) && $(MAKE) clean-profiles
44
45 mcs-do-run-test: tmpinst-dir
46         tmpinst=`cd _tmpinst && pwd` ; mcs_topdir=`cd $(mcs_topdir) && pwd`; \
47         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
48         cd $(mcs_topdir) && $(MAKE) PROFILE=default TEST_RUNTIME="MONO_PATH=$$mcs_topdir/class/lib/default mono" run-test
49
50 # Build stripped down versions of 'mcs', 'mscorlib.dll' and 'System.dll' with installed 'mcs'
51 ## remove System.Xml.dll since it's a soft-dependency of System.dll
52 stage1-mcs: 
53         rm -f $(mcs_topdir)/mcs/mcs.exe $(mcs_topdir)/class/lib/default/mscorlib.dll
54         rm -f $(mcs_topdir)/class/lib/default/System.dll $(mcs_topdir)/class/lib/default/System.Xml.dll
55         cd $(mcs_topdir)/jay && $(MAKE)
56         cd $(mcs_topdir)/mcs && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB"
57         cd $(mcs_topdir)/class/corlib && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB"
58         cd $(mcs_topdir)/class/System && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB" MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB"
59
60 # Build enough of 'mono' to run the stage1 mcs.exe
61 stage1-mono: $(CONFIG_HEADER)
62         if test -z "$(libgc_dir)"; then :; else cd libgc && $(MAKE) ; fi
63         cd mono && $(MAKE)
64
65 # (takes advantage of 'make -j': independent subtasks are separate dependencies)
66 stage1: stage1-mcs stage1-mono tmpinst-dir
67         $(MAKE) tmpinst-runtime
68
69 # Use stage1 'mcs', 'mscorlib.dll' and 'System.dll' to build fuller versions
70 # FIXME: Mono.CSharp.Debugger is built only on Linux in the MCS tree.
71 #        At least the SymbolWriter stuff seems portable enough.  So either
72 #        fix the MCS tree, or fix it here
73 stage2: stage1
74         set -e ; \
75         tmpinst=`cd _tmpinst && pwd` ; mcs_topdir=`cd $(mcs_topdir) && pwd` ; \
76         PATH=$$tmpinst/bin:$$PATH; export PATH ; \
77         cd $$mcs_topdir/mcs && $(MAKE) PROFILE=default ; \
78         cd $$mcs_topdir/class/corlib && $(MAKE) PROFILE=default ; \
79         cd $$mcs_topdir/class/System && $(MAKE) PROFILE=default ; \
80         cd $$mcs_topdir/class/Mono.CSharp.Debugger && $(MAKE) PROFILE=default
81         $(MAKE) tmpinst-runtime
82
83 # Use stage2 binaries to build the whole tree
84 stage3: stage2
85         tmpinst=`cd _tmpinst && pwd` ; \
86         PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
87         cd $(mcs_topdir) && $(MAKE) all-profiles
88
89 tmpinst-dir.stamp: Makefile.am
90         set -e ; \
91         rootme=`pwd`; tmpinst=$$rootme/_tmpinst ; \
92         mkdir -p $$tmpinst $$tmpinst/bin $$tmpinst/lib ; \
93         echo '#! /bin/sh' > $$tmpinst/bin/mono ; \
94         echo 'if test -z "$$MONO_PATH" ; then MONO_PATH="'"$$tmpinst/lib"'"' >> $$tmpinst/bin/mono ; \
95         echo 'else MONO_PATH=$${MONO_PATH}:"'"$$tmpinst/lib"'" ; fi' >> $$tmpinst/bin/mono ; \
96         echo 'export MONO_PATH' >> $$tmpinst/bin/mono ; \
97         echo 'exec "'"$$rootme/libtool"'" --mode=execute "'"$$rootme/$(mono_runtime)"'" "$$@"' >> $$tmpinst/bin/mono ; \
98         echo '#! /bin/sh' > $$tmpinst/bin/mcs ; \
99         echo 'exec "'"$$tmpinst/bin/mono"'" "'"$$tmpinst/lib/mcs.exe"'" "$$@"' >> $$tmpinst/bin/mcs ; \
100         chmod +x $$tmpinst/bin/mono $$tmpinst/bin/mcs
101         echo "stamp" > $@
102
103 tmpinst-dir: tmpinst-dir.stamp
104         @if test -d _tmpinst; then :; else rm -f tmpinst-dir.stamp; $(MAKE) tmpinst-dir.stamp; fi
105
106 tmpinst-runtime:
107         tmpinst=`cd _tmpinst && pwd` && \
108         mv -f $(mcs_topdir)/mcs/mcs.exe $$tmpinst/lib && \
109         mv -f $(mcs_topdir)/class/lib/default/mscorlib.dll $(mcs_topdir)/class/lib/default/System.dll $$tmpinst/lib && \
110         if test -f $(mcs_topdir)/class/lib/default/Mono.CSharp.Debugger.dll; then \
111           mv -f $(mcs_topdir)/class/lib/default/Mono.CSharp.Debugger.dll $$tmpinst/lib ; else : ; fi
112
113 # Obsolete target -- don't use.
114 .PHONY: fullbuild
115 fullbuild: bootstrap
116         $(MAKE) install
117         echo "*** 'fullbuild' is an obsolete target. Use 'make bootstrap && make install'."
118         exit 1
119
120 win32getdeps:
121         wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
122         wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip 
123         wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip 
124         wget http://www.go-mono.com/archive/libiconv-1.7.zip 
125         wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip 
126         wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
127         wget http://www.jroith.de/nsis4cygwin.zip
128         unzip -n -d / pkgconfig-0.11-20020310.zip
129         unzip -n -d / glib-2.0.4-20020703.zip
130         unzip -n -d / glib-dev-2.0.4-20020703.zip
131         unzip -n -d / libiconv-1.7.zip
132         unzip -n -d / libiconv-dev-1.7.zip
133         unzip -n -d / libintl-0.10.40-20020101.zip
134         unzip -n -d / nsis4cygwin.zip
135
136 win32setup:
137         cp /usr/lib/libglib-2.0-0.dll @prefix@/lib
138         cp /usr/lib/iconv.dll @prefix@/lib
139         cp /usr/lib/libgmodule-2.0-0.dll @prefix@/lib
140         cp /usr/lib/libgobject-2.0-0.dll @prefix@/lib
141         cp /usr/lib/libgthread-2.0-0.dll @prefix@/lib
142         cp /usr/lib/libintl-1.dll @prefix@/lib
143         makensis /DMILESTONE=@VERSION@ /DSOURCE_INSTALL_DIR=`cygpath -a -w @prefix@`\\* monowiz.win32.nsi