2009-05-18 Miguel de Icaza <miguel@novell.com>
[mono.git] / runtime / Makefile.am
1 # hack to prevent 'check' from depending on 'all'
2 AUTOMAKE_OPTIONS = cygnus
3
4 tmpinst = _tmpinst
5
6 noinst_SCRIPTS = mono-wrapper monodis-wrapper
7
8 etctmp = etc
9 symlinks = etc/mono/1.0/machine.config etc/mono/2.0/machine.config etc/mono/2.0/web.config etc/mono/browscap.ini etc/mono/2.0/Browsers/Compat.browser
10
11 etc/mono/1.0/machine.config: $(top_srcdir)/data/net_1_1/machine.config
12 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
13 etc/mono/2.0/web.config: $(top_srcdir)/data/net_2_0/web.config
14 etc/mono/browscap.ini: $(top_srcdir)/data/browscap.ini
15 etc/mono/2.0/Browsers/Compat.browser: $(top_srcdir)/data/net_2_0/Browsers/Compat.browser
16
17 $(symlinks):
18         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
19
20 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
21
22 if INSTALL_2_0
23 if INSTALL_2_1
24 build_profiles = net_1_1 net_2_0 net_3_5 net_2_1_raw
25 test_profiles = net_1_1 net_2_0 net_3_5 net_2_1
26 else
27 build_profiles = net_1_1 net_2_0 net_3_5
28 test_profiles = $(build_profiles)
29 endif
30 else
31 build_profiles = net_1_1
32 test_profiles = $(build_profiles)
33 endif
34
35 if BUILD_MCS
36
37 # The write check is to foil 'make distcheck'
38 all-local: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
39         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
40         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
41
42 # override automake
43 install: install-exec install-data
44
45 # override automake
46 install-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
47         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
48
49 # override automake
50 install-data:
51         @:
52
53 # override automake
54 uninstall:
55         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
56
57 ## mono --wapi=semdel will probably not delete the semaphore if someone is crazy enough to do a 'make -j distclean' :-)
58 clean-local:
59         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
60         -./mono-wrapper --wapi=semdel
61         -rm -fr $(etctmp) $(tmpinst) .wapi
62
63 endif BUILD_MCS
64
65 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/bin/ilasm $(tmpinst)/bin/gmcs
66
67 # now a misnomer, but it'll go away soon enough.
68 if ENABLE_NUNIT_TESTS
69 test_select =
70 else
71 test_select = ONLY_CENTUM_TESTS=yes
72 endif
73
74 if INSTALL_2_1
75 moon-do-build: test-support-files
76         cd $(top_builddir)/../moon/class && $(MAKE) all
77 else
78 moon-do-build:
79         @:
80 endif
81
82 mcs-do-test-profiles:
83         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
84
85 mcs-do-run-test-profiles: test-support-files
86         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
87
88 if PLATFORM_WIN32
89 if CROSS_COMPILING
90 cur_dir_cmd = pwd
91 PLATFORM_PATH_SEPARATOR = :
92 else
93 cur_dir_cmd = cygpath -w -a .
94 PLATFORM_PATH_SEPARATOR = ;
95 endif
96 else
97 cur_dir_cmd = pwd
98 PLATFORM_PATH_SEPARATOR = :
99 endif
100
101 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
102 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
103 # Skip net 2.1 assemblies for now because of visibility problems
104 mcs-compileall: mono-wrapper etc/mono/config
105         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
106         for profile in $(test_profiles); do \
107           if [ "net_2_1" = "$$profile" ]; then \
108           break; \
109       fi; \
110           if [ "net_3_5" = "$$profile" ]; then \
111                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
112           else \
113                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
114           fi; \
115           export MONO_PATH; \
116           for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
117                 if [ ! -f $$i ] ; then \
118                         continue ; \
119                 fi ;  \
120             if ./mono-wrapper --compile-all --verify-all --security=validil $$i; then \
121               echo $$i verified OK; \
122             else \
123               echo $$i verification failed; ok=false; \
124             fi; done; done; \
125         $$ok
126
127 check-local: mcs-compileall mcs-do-test-profiles
128         $(MAKE) $(test_select) mcs-do-run-test-profiles
129
130 CLEANFILES = etc/mono/config
131
132 # depend on $(symlinks) to ensure 'etc/mono' directory exists
133 etc/mono/config: ../data/config Makefile $(symlinks)
134         d=`cd ../support && pwd`; \
135         sed 's,target="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@t
136         if test -z "$(libgdiplus_loc)"; then :; else \
137           sed 's,<configuration>,& <dllmap dll="gdiplus.dll" target="$(libgdiplus_loc)" />,' $@t > $@tt; \
138           mv -f $@tt $@t; fi
139         mv -f $@t $@
140
141 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
142         $(mkinstalldirs) $(tmpinst)/bin
143         cp mono-wrapper $@
144
145 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
146         echo '#! /bin/sh' > $@ ; \
147         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
148         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/net_1_1/mcs.exe"'" "$$@"' >> $@ ; \
149         chmod +x $@
150
151 $(tmpinst)/bin/gmcs: $(tmpinst)/bin/mono Makefile
152         echo '#! /bin/sh' > $@ ; \
153         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
154         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/net_2_0/gmcs.exe"'" "$$@"' >> $@ ; \
155         chmod +x $@
156
157 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
158         echo '#! /bin/sh' > $@ ; \
159         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
160         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
161         chmod +x $@
162
163 test-support-files: $(TEST_SUPPORT_FILES)
164         @:
165
166 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
167 MYDISTFILES = $(DIST_COMMON)
168 distdir: $(MYDISTFILES)
169         rm -fr $(distdir)
170         mkdir $(distdir)
171         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
172           cp -p $$file $(distdir) ; done
173         find $(distdir) -type f -exec chmod a+r {} ';'