[arm64] Add location of this and rgctx arg
[mono-project.git] / runtime / Makefile.am
blob154240d758de6bf1f30aadc7a05283d14f164c36
2 tmpinst = _tmpinst
4 noinst_SCRIPTS = mono-wrapper monodis-wrapper
6 etctmp = etc
7 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
9 if INSTALL_4_x
10 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
11 endif
13 # This is needed at least to build configure --with-runtime-preset=fullaot.
14 symlinks += etc/mono/4.5/machine.config
16 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
17 etc/mono/2.0/web.config: $(top_srcdir)/data/net_2_0/web.config
18 etc/mono/browscap.ini: $(top_srcdir)/data/browscap.ini
19 etc/mono/2.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
20 etc/mono/4.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
21 etc/mono/4.5/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
22 etc/mono/4.0/machine.config: $(top_srcdir)/data/net_4_0/machine.config
23 etc/mono/4.0/web.config: $(top_srcdir)/data/net_4_0/web.config
24 etc/mono/4.5/machine.config: $(top_srcdir)/data/net_4_5/machine.config
25 etc/mono/4.5/web.config: $(top_srcdir)/data/net_4_5/web.config
27 $(symlinks):
28         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
30 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
32 build_profiles = 
34 if INSTALL_4_x
35 build_profiles += binary_reference_assemblies net_4_x xbuild_12 xbuild_14
36 net_profile = net_4_x
37 endif
39 if INSTALL_MONODROID
40 build_profiles += monodroid monodroid_tools
41 endif
43 if INSTALL_MONOTOUCH
44 build_profiles += monotouch monotouch_runtime
45 endif
47 if INSTALL_MONOTOUCH_WATCH
48 build_profiles += monotouch_watch monotouch_watch_runtime
49 endif
51 if INSTALL_MONOTOUCH_TV
52 build_profiles += monotouch_tv monotouch_tv_runtime
53 endif
55 if INSTALL_TESTING_AOT_FULL_INTERP
56 build_profiles += testing_aot_full_interp
57 endif
59 if INSTALL_TESTING_AOT_HYBRID
60 build_profiles += testing_aot_hybrid
61 endif
63 if INSTALL_TESTING_AOT_FULL
64 build_profiles += testing_aot_full
65 endif
67 if INSTALL_WINAOT
68 build_profiles += winaot
69 endif
71 if INSTALL_TESTING_WINAOT_INTERP
72 build_profiles += testing_winaot_interp
73 endif
75 if INSTALL_XAMMAC
76 build_profiles += xammac xammac_net_4_5
77 endif
79 if INSTALL_ORBIS
80 build_profiles += orbis
81 endif
83 if INSTALL_UNREAL
84 build_profiles += unreal
85 endif
87 if INSTALL_WASM
88 build_profiles += wasm wasm_tools
89 endif
91 if ENABLE_NETCORE
92 build_profiles += netcore
93 endif
95 test_profiles = $(filter-out binary_reference_assemblies monodroid_tools wasm_tools,$(build_profiles))
97 MAKE_FLAGS=$(if $(V),,--no-print-directory -s)
99 # The write check is to foil 'make distcheck'
100 all-mcs: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
101         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
102         cd $(mcs_topdir) && $(MAKE) $(MAKE_FLAGS) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
104 install-mcs: install-mcs-exec install-mcs-data
106 # override automake
107 install-mcs-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
108         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
110 # override automake
111 install-mcs-data:
112         @:
114 # override automake
115 uninstall-mcs:
116         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
118 clean-mcs:
119         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
120         -rm -fr $(etctmp) $(tmpinst)
122 if BUILD_MCS
124 all-local: all-mcs
126 # override automake
127 install: install-mcs
129 # override automake
130 install-exec: install-mcs-exec
132 # override automake
133 install-data: install-mcs-data
135 # override automake
136 uninstall: uninstall-mcs
138 clean-local: clean-mcs
140 endif BUILD_MCS
142 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/csc $(tmpinst)/bin/mcs $(tmpinst)/bin/al
144 mcs-do-test-profiles:
145         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
146         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' compiler-test-profiles
148 mcs-do-xunit-test-profiles:
149         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' xunit-test-profiles
151 mcs-do-run-test-profiles: test-support-files
152         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
153         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-compiler-test-profiles
155 mcs-do-xunit-run-test-profiles: test-support-files
156         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-xunit-test-profiles
158 test-bundle-local:
159         mkdir -p $(TEST_BUNDLE_PATH)/_tmpinst/bin
160         cp -L mono-test.sh $(TEST_BUNDLE_PATH)
161         cp -L -R etc $(TEST_BUNDLE_PATH)/_tmpinst
162         rm $(TEST_BUNDLE_PATH)/_tmpinst/etc/mono/config
163         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
164         echo '#! /bin/sh' > $(TEST_BUNDLE_PATH)/_tmpinst/bin/al
165         echo '#! /bin/sh' > $(TEST_BUNDLE_PATH)/_tmpinst/bin/mcs
166         echo '#! /bin/sh' > $(TEST_BUNDLE_PATH)/_tmpinst/bin/ilasm
167         echo '"$$MONO_EXECUTABLE" $$(dirname "$$MONO_EXECUTABLE")/net_4_x/al.exe "$$@"' >> $(TEST_BUNDLE_PATH)/_tmpinst/bin/al
168         echo '"$$MONO_EXECUTABLE" $$(dirname "$$MONO_EXECUTABLE")/net_4_x/mcs.exe "$$@"' >> $(TEST_BUNDLE_PATH)/_tmpinst/bin/mcs
169         echo '"$$MONO_EXECUTABLE" $$(dirname "$$MONO_EXECUTABLE")/net_4_x/ilasm.exe "$$@"' >> $(TEST_BUNDLE_PATH)/_tmpinst/bin/ilasm
170         chmod +x $(TEST_BUNDLE_PATH)/_tmpinst/bin/al
171         chmod +x $(TEST_BUNDLE_PATH)/_tmpinst/bin/mcs
172         chmod +x $(TEST_BUNDLE_PATH)/_tmpinst/bin/ilasm
173         for profile in $(test_profiles); do \
174                 cp -L -R $(mcs_topdir)/class/lib/$$profile $(TEST_BUNDLE_PATH); \
175         done
176         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/
177         $(MAKE) -C $(mcs_topdir)/tests test-bundle
178         $(MAKE) -C $(mcs_topdir)/errors test-bundle
179         $(MAKE) -C $(mcs_topdir)/packages test-bundle
180         $(MAKE) -C $(mcs_topdir)/tools/mono-symbolicate test-bundle
182 if HOST_WIN32
183 if CROSS_COMPILING
184 cur_dir_cmd = pwd
185 PLATFORM_PATH_SEPARATOR = :
186 else
187 cur_dir_cmd = cygpath -w -a .
188 PLATFORM_PATH_SEPARATOR = ;
189 endif
190 else
191 cur_dir_cmd = pwd
192 PLATFORM_PATH_SEPARATOR = :
193 endif
195 # assemblies which are excluded from testing in mcs-compileall below
196 VERIFY_TESTS_FILTER = System.Runtime.CompilerServices.Unsafe.dll
198 if HOST_WIN32
199 # Mono.WebBrowser.dll fails to verify on Windows
200 VERIFY_TESTS_FILTER += Mono.WebBrowser.dll
201 endif
203 # fails to verify with "VTable setup of type Xunit.NetCore.Extensions.SkippedTestCase failed", not sure why
204 VERIFY_TESTS_FILTER += Xunit.NetCore.Extensions.dll
206 if FULL_AOT_TESTS
207 #  ILASM.exe has features which a testing_aot_full runtime will not support.
208 #  It is invoked with an external mono when used in the runtime.
209 #  We skip it here because otherwise it will fail to verify.
210 VERIFY_TESTS_FILTER += ilasm.exe
211 endif
213 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
214 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
215 mcs-compileall: mono-wrapper etc/mono/config
216         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
217         for profile in $(test_profiles); do \
218           if [ "xbuild_12" = "$$profile" ]; then \
219                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
220           elif [ "xbuild_14" = "$$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           else \
223                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
224           fi; \
225           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))` ; \
226           export MONO_PATH; \
227           for stub in $$verifiable_files; do \
228           i=$(mcs_topdir)/class/lib/$$profile/$$stub ; \
229           echo $$i ; \
230                 if [ ! -f $$i ] ; then \
231                         continue ; \
232                 fi ;  \
233             if ./mono-wrapper --compile-all --verify-all --security=verifiable $$i; then \
234               echo $$i verified OK; \
235             else \
236               echo $$i verification failed; ok=false; \
237             fi; done; done; \
238         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; \
239         $$ok
241 check-local: mcs-compileall mcs-do-test-profiles mcs-do-xunit-test-profiles
242         $(MAKE) mcs-do-run-test-profiles mcs-do-run-xunit-test-profiles
244 # Compile all mcs tests
245 test: mcs-do-test-profiles
246 xunit-test: mcs-do-xunit-test-profiles
248 CLEANFILES = etc/mono/config
250 # depend on $(symlinks) to ensure 'etc/mono' directory exists
251 etc/mono/config: ../data/config Makefile $(symlinks)
252         cp $< $@
253         if test -d "$(abs_top_builddir)/support"; then \
254                 sed 's,target="$$mono_libdir/libMonoPosixHelper$(libsuffix)",target="$(abs_top_builddir)/support/libMonoPosixHelper.la",' $@ > $@.tmp \
255                  && mv $@.tmp $@ \
256                  ; \
257         else \
258                 echo "Unknown directory '$(abs_top_builddir)/support'" && false; \
259         fi
260         if test -d "$(abs_top_builddir)/mono/native"; then \
261                 sed 's,target="$$mono_libdir/$(MONO_NATIVE_LIBRARY_NAME)$(libsuffix)",target="$(abs_top_builddir)/mono/native/$(MONO_NATIVE_LIBRARY_NAME).la",' $@ > $@.tmp \
262                  && mv $@.tmp $@ \
263                  ; \
264         else \
265                 echo "Unknown directory '$(abs_top_builddir)/mono/native'" && false; \
266         fi
267         if test -d "$(abs_top_builddir)/mono/btls/build-shared"; then \
268                 sed 's,target="$$mono_libdir/libmono-btls-shared$(libsuffix)",target="$(abs_top_builddir)/mono/btls/build-shared/libmono-btls-shared$(libsuffix)",' $@ > $@.tmp \
269                  && mv $@.tmp $@ \
270                  ; \
271         else \
272                 echo "Unknown directory '$(abs_top_builddir)/mono/btls/build-shared'"; \
273         fi
274         if test -n "$(libgdiplus_loc)"; then \
275                 sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@ > $@.tmp \
276                  && mv $@.tmp $@ \
277                  ; \
278         fi
279         cat $@
281 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
282         $(mkinstalldirs) $(tmpinst)/bin
283         cp mono-wrapper $@
285 $(tmpinst)/bin/csc: $(tmpinst)/bin/mono Makefile
286         echo '#! /bin/sh' > $@ ; \
287         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
288         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$(CSC)"'" "$$@"' >> $@ ; \
289         chmod +x $@
291 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
292         echo '#! /bin/sh' > $@ ; \
293         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
294         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(net_profile)/mcs.exe"'" "$$@"' >> $@ ; \
295         chmod +x $@
297 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
298         echo '#! /bin/sh' > $@ ; \
299         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
300         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
301         chmod +x $@
303 $(tmpinst)/bin/al: $(tmpinst)/bin/mono Makefile
304         echo '#! /bin/sh' > $@ ; \
305         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
306         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(net_profile)/al.exe"'" "$$@"' >> $@ ; \
307         chmod +x $@
309 test-support-files: $(TEST_SUPPORT_FILES)
310         @:
312 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
313 MYDISTFILES = $(DIST_COMMON)
314 distdir: $(MYDISTFILES)
315         rm -fr $(distdir)
316         mkdir $(distdir)
317         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
318           cp -p $$file $(distdir) ; done
319         find $(distdir) -type f -exec chmod a+r {} ';'