[runtime] Fix compilation under Android
[mono-project.git] / runtime / Makefile.am
blob98609dc55babab32f450d31f7848f757c71e59e5
1 tmpinst = _tmpinst
3 noinst_SCRIPTS = mono-wrapper monodis-wrapper
5 etctmp = etc
6 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
8 if INSTALL_4_x
9 symlinks += etc/mono/4.0/machine.config etc/mono/4.0/web.config etc/mono/4.5/web.config etc/mono/4.5/machine.config etc/mono/4.0/Browsers/Compat.browser etc/mono/4.5/Browsers/Compat.browser
10 endif
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/Browsers/Compat.browser
16 etc/mono/4.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
17 etc/mono/4.5/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
18 etc/mono/4.0/machine.config: $(top_srcdir)/data/net_4_0/machine.config
19 etc/mono/4.0/web.config: $(top_srcdir)/data/net_4_0/web.config
20 etc/mono/4.5/machine.config: $(top_srcdir)/data/net_4_5/machine.config
21 etc/mono/4.5/web.config: $(top_srcdir)/data/net_4_5/web.config
23 $(symlinks):
24         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
26 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
28 build_profiles = 
30 if INSTALL_4_x
31 build_profiles += binary_reference_assemblies net_4_x xbuild_12 xbuild_14
32 net_profile = net_4_x
33 endif
35 if INSTALL_MONODROID
36 build_profiles += monodroid
37 endif
39 if INSTALL_MONOTOUCH
40 build_profiles += monotouch monotouch_runtime
41 endif
43 if INSTALL_MONOTOUCH_WATCH
44 build_profiles += monotouch_watch monotouch_watch_runtime
45 endif
47 if INSTALL_MONOTOUCH_TV
48 build_profiles += monotouch_tv monotouch_tv_runtime
49 endif
51 if INSTALL_TESTING_AOT_HYBRID
52 build_profiles += testing_aot_hybrid
53 endif
55 if INSTALL_TESTING_AOT_FULL
56 build_profiles += testing_aot_full
57 endif
59 if INSTALL_WINAOT
60 build_profiles += winaot
61 endif
63 if INSTALL_XAMMAC
64 build_profiles += xammac xammac_net_4_5
65 endif
67 if INSTALL_ORBIS
68 build_profiles += orbis
69 endif
71 test_profiles = $(build_profiles)
73 if BUILD_MCS
75 MAKE_FLAGS=$(if $(V),,--no-print-directory -s)
77 # The write check is to foil 'make distcheck'
78 all-local: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
79         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
80         cd $(mcs_topdir) && $(MAKE) $(MAKE_FLAGS) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
82 # override automake
83 install: install-exec install-data
85 # override automake
86 install-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
87         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
89 # override automake
90 install-data:
91         @:
93 # override automake
94 uninstall:
95         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
97 clean-local:
98         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
99         -rm -fr $(etctmp) $(tmpinst)
101 endif BUILD_MCS
103 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/csc $(tmpinst)/bin/mcs $(tmpinst)/bin/al
105 mcs-do-test-profiles:
106         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
108 mcs-do-run-test-profiles: test-support-files
109         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
111 if HOST_WIN32
112 if CROSS_COMPILING
113 cur_dir_cmd = pwd
114 PLATFORM_PATH_SEPARATOR = :
115 else
116 cur_dir_cmd = cygpath -w -a .
117 PLATFORM_PATH_SEPARATOR = ;
118 endif
119 else
120 cur_dir_cmd = pwd
121 PLATFORM_PATH_SEPARATOR = :
122 endif
124 # assemblies which are excluded from testing in mcs-compileall below
125 VERIFY_TESTS_FILTER =
127 if HOST_WIN32
128 # Mono.WebBrowser.dll fails to verify on Windows
129 VERIFY_TESTS_FILTER += Mono.WebBrowser.dll
130 endif
132 if FULL_AOT_TESTS
133 #  ILASM.exe has features which a testing_aot_full runtime will not support.
134 #  It is invoked with an external mono when used in the runtime.
135 #  We skip it here because otherwise it will fail to verify.
136 VERIFY_TESTS_FILTER += ilasm.exe
137 endif
139 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
140 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
141 # Skip binary_reference_assemblies because they contain metadata only
142 mcs-compileall: mono-wrapper etc/mono/config
143         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
144         for profile in $(test_profiles); do \
145           if [ "binary_reference_assemblies" = "$$profile" ]; then \
146           continue; \
147           elif [ "xbuild_12" = "$$profile" ]; then \
148                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
149           elif [ "xbuild_14" = "$$profile" ]; then \
150                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
151           else \
152                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
153           fi; \
154           export verifiable_files=`ls "$(mcs_topdir)/class/lib/$$profile/" | grep -E '\.(dll|exe)$$' $(foreach asm,$(VERIFY_TESTS_FILTER), | grep -v $(asm))` ; \
155           export MONO_PATH; \
156           for stub in $$verifiable_files; do \
157           i=$(mcs_topdir)/class/lib/$$profile/$$stub ; \
158           echo $$i ; \
159                 if [ ! -f $$i ] ; then \
160                         continue ; \
161                 fi ;  \
162             if ./mono-wrapper --compile-all --verify-all --security=verifiable $$i; then \
163               echo $$i verified OK; \
164             else \
165               echo $$i verification failed; ok=false; \
166             fi; done; done; \
167         $$ok
169 if NACL_CODEGEN
170 check-local:
171 else
172 check-local: mcs-compileall mcs-do-test-profiles
173         $(MAKE) mcs-do-run-test-profiles
174 endif
176 # Compile all mcs tests
177 test: mcs-do-test-profiles
179 CLEANFILES = etc/mono/config
181 # depend on $(symlinks) to ensure 'etc/mono' directory exists
182 etc/mono/config: ../data/config Makefile $(symlinks)
183         d=`cd ../support && pwd`; \
184         sed 's,target="$$mono_libdir/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
185         d=`cd ../mono/btls/build-shared && pwd`; \
186         sed 's,target="$$mono_libdir/libmono-btls-shared$(libsuffix)",target="'$$d'/libmono-btls-shared$(libsuffix)",' $@t > $@tt
187         if test -z "$(libgdiplus_loc)"; then :; else \
188           sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@tt > $@ttt; \
189           mv -f $@ttt $@tt; fi
190         mv -f $@tt $@
191         rm -f $@t
193 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
194         $(mkinstalldirs) $(tmpinst)/bin
195         cp mono-wrapper $@
197 $(tmpinst)/bin/csc: $(tmpinst)/bin/mono Makefile
198         echo '#! /bin/sh' > $@ ; \
199         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
200         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$(CSC)"'" "$$@"' >> $@ ; \
201         chmod +x $@
203 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
204         echo '#! /bin/sh' > $@ ; \
205         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
206         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(net_profile)/mcs.exe"'" "$$@"' >> $@ ; \
207         chmod +x $@
209 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
210         echo '#! /bin/sh' > $@ ; \
211         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
212         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
213         chmod +x $@
215 $(tmpinst)/bin/al: $(tmpinst)/bin/mono Makefile
216         echo '#! /bin/sh' > $@ ; \
217         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
218         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(net_profile)/al.exe"'" "$$@"' >> $@ ; \
219         chmod +x $@
221 test-support-files: $(TEST_SUPPORT_FILES)
222         @:
224 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
225 MYDISTFILES = $(DIST_COMMON)
226 distdir: $(MYDISTFILES)
227         rm -fr $(distdir)
228         mkdir $(distdir)
229         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
230           cp -p $$file $(distdir) ; done
231         find $(distdir) -type f -exec chmod a+r {} ';'