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