Makefile.am 9.6 KB

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