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