[2020-02] [merp] Add API methods for getting hashcode/reason of last crash (#19978)
[mono-project.git] / runtime / Makefile.am
blob9e29cb58e3305e65fb55f13add8a9b53c85a8faf
2 tmpinst = _tmpinst
4 noinst_SCRIPTS = mono-wrapper monodis-wrapper
6 EXTRA_DIST = bin/mono-hang-watchdog.in
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
11 if INSTALL_4_x
12 symlinks += etc/mono/4.0/machine.config etc/mono/4.0/web.config etc/mono/4.5/web.config etc/mono/4.0/Browsers/Compat.browser etc/mono/4.5/Browsers/Compat.browser
13 endif
15 # This is needed at least to build configure --with-runtime-preset=fullaot.
16 symlinks += etc/mono/4.5/machine.config
18 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
19 etc/mono/2.0/web.config: $(top_srcdir)/data/net_2_0/web.config
20 etc/mono/browscap.ini: $(top_srcdir)/data/browscap.ini
21 etc/mono/2.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
22 etc/mono/4.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
23 etc/mono/4.5/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
24 etc/mono/4.0/machine.config: $(top_srcdir)/data/net_4_0/machine.config
25 etc/mono/4.0/web.config: $(top_srcdir)/data/net_4_0/web.config
26 etc/mono/4.5/machine.config: $(top_srcdir)/data/net_4_5/machine.config
27 etc/mono/4.5/web.config: $(top_srcdir)/data/net_4_5/web.config
29 $(symlinks):
30         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
32 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
34 build_profiles = 
36 if INSTALL_4_x
37 build_profiles += binary_reference_assemblies net_4_x xbuild_12 xbuild_14
38 net_profile = net_4_x
39 endif
41 if INSTALL_MONODROID
42 build_profiles += monodroid monodroid_tools
43 endif
45 if INSTALL_MONOTOUCH
46 build_profiles += monotouch monotouch_runtime
47 endif
49 if INSTALL_MONOTOUCH_WATCH
50 build_profiles += monotouch_watch monotouch_watch_runtime
51 endif
53 if INSTALL_MONOTOUCH_TV
54 build_profiles += monotouch_tv monotouch_tv_runtime
55 endif
57 if INSTALL_TESTING_AOT_FULL_INTERP
58 build_profiles += testing_aot_full_interp
59 endif
61 if INSTALL_TESTING_AOT_HYBRID
62 build_profiles += testing_aot_hybrid
63 endif
65 if INSTALL_TESTING_AOT_FULL
66 build_profiles += testing_aot_full
67 endif
69 if INSTALL_WINAOT
70 build_profiles += winaot
71 endif
73 if INSTALL_TESTING_WINAOT_INTERP
74 build_profiles += testing_winaot_interp
75 endif
77 if INSTALL_XAMMAC
78 build_profiles += xammac xammac_net_4_5
79 endif
81 if INSTALL_ORBIS
82 build_profiles += orbis
83 endif
85 if INSTALL_UNREAL
86 build_profiles += unreal
87 endif
89 if INSTALL_WASM
90 build_profiles += wasm wasm_tools
91 endif
93 if ENABLE_NETCORE
94 build_profiles += netcore
95 endif
97 test_profiles = $(filter-out binary_reference_assemblies monodroid_tools wasm_tools,$(build_profiles))
99 MAKE_FLAGS=$(if $(V),,--no-print-directory -s)
101 # The write check is to foil 'make distcheck'
102 all-mcs: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
103         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
104         cd $(mcs_topdir) && $(MAKE) $(MAKE_FLAGS) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
106 install-mcs: install-mcs-exec install-mcs-data
108 # override automake
109 install-mcs-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
110         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
112 # override automake
113 install-mcs-data:
114         @:
116 # override automake
117 uninstall-mcs:
118         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
120 clean-mcs:
121         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
122         -rm -fr $(etctmp) $(tmpinst)
124 if BUILD_MCS
126 all-local: all-mcs
128 # override automake
129 install: install-mcs
131 # override automake
132 install-exec: install-mcs-exec
134 # override automake
135 install-data: install-mcs-data
137 # override automake
138 uninstall: uninstall-mcs
140 clean-local: clean-mcs
142 endif BUILD_MCS
144 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/csc $(tmpinst)/bin/mcs $(tmpinst)/bin/al
146 mcs-do-test-profiles:
147         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
148         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' compiler-test-profiles
150 mcs-do-xunit-test-profiles:
151         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' xunit-test-profiles
153 mcs-do-run-test-profiles: test-support-files
154         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
155         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-compiler-test-profiles
157 mcs-do-xunit-run-test-profiles: test-support-files
158         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-xunit-test-profiles
160 test-bundle-local:
161         mkdir -p $(TEST_BUNDLE_PATH)/_tmpinst/bin
162         cp -L mono-test.sh $(TEST_BUNDLE_PATH)
163         cp -L -R etc $(TEST_BUNDLE_PATH)/_tmpinst
164         rm $(TEST_BUNDLE_PATH)/_tmpinst/etc/mono/config
165         sed -e 's,$$mono_libdir,$$test_root_dir,g' -e 's,target="$(libgdiplus_install_loc)",target="$$test_root_dir/mono-libgdiplus$(libsuffix)",g' $(top_builddir)/data/config > $(TEST_BUNDLE_PATH)/_tmpinst/etc/mono/config.tmpl
166         echo '#! /bin/sh' > $(TEST_BUNDLE_PATH)/_tmpinst/bin/al
167         echo '#! /bin/sh' > $(TEST_BUNDLE_PATH)/_tmpinst/bin/mcs
168         echo '#! /bin/sh' > $(TEST_BUNDLE_PATH)/_tmpinst/bin/ilasm
169         echo '"$$MONO_EXECUTABLE" $$(dirname "$$MONO_EXECUTABLE")/net_4_x/al.exe "$$@"' >> $(TEST_BUNDLE_PATH)/_tmpinst/bin/al
170         echo '"$$MONO_EXECUTABLE" $$(dirname "$$MONO_EXECUTABLE")/net_4_x/mcs.exe "$$@"' >> $(TEST_BUNDLE_PATH)/_tmpinst/bin/mcs
171         echo '"$$MONO_EXECUTABLE" $$(dirname "$$MONO_EXECUTABLE")/net_4_x/ilasm.exe "$$@"' >> $(TEST_BUNDLE_PATH)/_tmpinst/bin/ilasm
172         chmod +x $(TEST_BUNDLE_PATH)/_tmpinst/bin/al
173         chmod +x $(TEST_BUNDLE_PATH)/_tmpinst/bin/mcs
174         chmod +x $(TEST_BUNDLE_PATH)/_tmpinst/bin/ilasm
175         for profile in $(test_profiles); do \
176                 cp -L -R $(mcs_topdir)/class/lib/$$profile $(TEST_BUNDLE_PATH); \
177         done
178         cp -L $(top_srcdir)/external/xunit-binaries/*.dll $(top_srcdir)/external/xunit-binaries/*.exe $(top_srcdir)/external/xunit-binaries/*.config $(TEST_BUNDLE_PATH)/net_4_x/
179         $(MAKE) -C $(mcs_topdir)/tests test-bundle
180         $(MAKE) -C $(mcs_topdir)/errors test-bundle
181         $(MAKE) -C $(mcs_topdir)/packages test-bundle
182         $(MAKE) -C $(mcs_topdir)/tools/mono-symbolicate test-bundle
184 if HOST_WIN32
185 if CROSS_COMPILING
186 cur_dir_cmd = pwd
187 PLATFORM_PATH_SEPARATOR = :
188 else
189 cur_dir_cmd = cygpath -w -a .
190 PLATFORM_PATH_SEPARATOR = ;
191 endif
192 else
193 cur_dir_cmd = pwd
194 PLATFORM_PATH_SEPARATOR = :
195 endif
197 # assemblies which are excluded from testing in mcs-compileall below
198 VERIFY_TESTS_FILTER = System.Runtime.CompilerServices.Unsafe.dll nunitlite.dll
200 if HOST_WIN32
201 # Mono.WebBrowser.dll fails to verify on Windows
202 VERIFY_TESTS_FILTER += Mono.WebBrowser.dll
203 endif
205 # fails to verify with "VTable setup of type Xunit.NetCore.Extensions.SkippedTestCase failed", not sure why
206 VERIFY_TESTS_FILTER += Xunit.NetCore.Extensions.dll
208 if FULL_AOT_TESTS
209 #  ILASM.exe has features which a testing_aot_full runtime will not support.
210 #  It is invoked with an external mono when used in the runtime.
211 #  We skip it here because otherwise it will fail to verify.
212 VERIFY_TESTS_FILTER += ilasm.exe
213 endif
215 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
216 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
217 mcs-compileall: mono-wrapper etc/mono/config
218         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
219         for profile in $(test_profiles); do \
220           if [ "xbuild_12" = "$$profile" ]; then \
221                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
222           elif [ "xbuild_14" = "$$profile" ]; then \
223                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
224           else \
225                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
226           fi; \
227           export verifiable_files=`ls "$(mcs_topdir)/class/lib/$$profile/" | grep -E '\.(dll|exe)$$' | grep -v '\.dll\.dll$$' | grep -v '\.exe\.dll$$' $(foreach asm,$(VERIFY_TESTS_FILTER), | grep -v $(asm))` ; \
228           export MONO_PATH; \
229           for stub in $$verifiable_files; do \
230           i=$(mcs_topdir)/class/lib/$$profile/$$stub ; \
231           echo $$i ; \
232                 if [ ! -f $$i ] ; then \
233                         continue ; \
234                 fi ;  \
235             if ./mono-wrapper --compile-all --verify-all --security=verifiable $$i; then \
236               echo $$i verified OK; \
237             else \
238               echo $$i verification failed; ok=false; \
239             fi; done; done; \
240         if [ "$$ok" = "false" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='verify' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='mcs-compileall' success='False' time='0'><results><test-case name='fail' executed='True' success='False' time='0'><failure><message>Verifying framework assemblies failed. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-verify.xml; fi; \
241         $$ok
243 check-local: mcs-compileall mcs-do-test-profiles mcs-do-xunit-test-profiles
244         $(MAKE) mcs-do-run-test-profiles mcs-do-run-xunit-test-profiles
246 # Compile all mcs tests
247 test: mcs-do-test-profiles
248 xunit-test: mcs-do-xunit-test-profiles
250 CLEANFILES = etc/mono/config
252 # depend on $(symlinks) to ensure 'etc/mono' directory exists
253 etc/mono/config: ../data/config Makefile $(symlinks)
254         cp $< $@
255         if test -d "$(abs_top_builddir)/support"; then \
256                 sed 's,target="$$mono_libdir/libMonoPosixHelper$(libsuffix)",target="$(abs_top_builddir)/support/libMonoPosixHelper.la",' $@ > $@.tmp \
257                  && mv $@.tmp $@ \
258                  ; \
259         else \
260                 echo "Unknown directory '$(abs_top_builddir)/support'" && false; \
261         fi
262         if test -d "$(abs_top_builddir)/mono/native"; then \
263                 sed 's,target="$$mono_libdir/$(MONO_NATIVE_LIBRARY_NAME)$(libsuffix)",target="$(abs_top_builddir)/mono/native/$(MONO_NATIVE_LIBRARY_NAME).la",' $@ > $@.tmp \
264                  && mv $@.tmp $@ \
265                  ; \
266         else \
267                 echo "Unknown directory '$(abs_top_builddir)/mono/native'" && false; \
268         fi
269         if test -d "$(abs_top_builddir)/mono/btls/build-shared"; then \
270                 sed 's,target="$$mono_libdir/libmono-btls-shared$(libsuffix)",target="$(abs_top_builddir)/mono/btls/build-shared/libmono-btls-shared$(libsuffix)",' $@ > $@.tmp \
271                  && mv $@.tmp $@ \
272                  ; \
273         else \
274                 echo "Unknown directory '$(abs_top_builddir)/mono/btls/build-shared'"; \
275         fi
276         if test -n "$(libgdiplus_loc)"; then \
277                 sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@ > $@.tmp \
278                  && mv $@.tmp $@ \
279                  ; \
280         fi
281         cat $@
283 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
284         $(mkinstalldirs) $(tmpinst)/bin
285         cp mono-wrapper $@
287 $(tmpinst)/bin/csc: $(tmpinst)/bin/mono Makefile
288         echo '#! /bin/sh' > $@ ; \
289         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
290         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$(CSC)"'" "$$@"' >> $@ ; \
291         chmod +x $@
293 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
294         echo '#! /bin/sh' > $@ ; \
295         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
296         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(net_profile)/mcs.exe"'" "$$@"' >> $@ ; \
297         chmod +x $@
299 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
300         echo '#! /bin/sh' > $@ ; \
301         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
302         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
303         chmod +x $@
305 $(tmpinst)/bin/al: $(tmpinst)/bin/mono Makefile
306         echo '#! /bin/sh' > $@ ; \
307         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
308         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(net_profile)/al.exe"'" "$$@"' >> $@ ; \
309         chmod +x $@
311 test-support-files: $(TEST_SUPPORT_FILES)
312         @: