Merged into single file, added assertions
[mono.git] / runtime / Makefile.am
1 # hack to prevent 'check' from depending on 'all'
2 AUTOMAKE_OPTIONS = cygnus
3
4 tmpinst = _tmpinst
5
6 noinst_SCRIPTS = mono-wrapper monodis-wrapper
7
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
10
11 if INSTALL_4_0
12 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
13 endif
14
15 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
16 etc/mono/2.0/web.config: $(top_srcdir)/data/net_2_0/web.config
17 etc/mono/browscap.ini: $(top_srcdir)/data/browscap.ini
18 etc/mono/2.0/Browsers/Compat.browser: $(top_srcdir)/data/net_2_0/Browsers/Compat.browser
19 etc/mono/4.0/machine.config: $(top_srcdir)/data/net_4_0/machine.config
20 etc/mono/4.0/web.config: $(top_srcdir)/data/net_4_0/web.config
21 etc/mono/4.5/machine.config: $(top_srcdir)/data/net_4_5/machine.config
22 etc/mono/4.5/web.config: $(top_srcdir)/data/net_4_5/web.config
23
24 $(symlinks):
25         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
26
27 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
28
29 if MOONLIGHT
30 moon-do-basic: Makefile $(SUPPORT_FILES)
31         cd $(mcs_topdir)/ && $(MAKE) NO_DIR_CHECK=1 PROFILE=moonlight_raw
32
33 moon-do-basic-clean:
34         cd $(mcs_topdir)/ && $(MAKE) NO_DIR_CHECK=1 PROFILE=moonlight_raw clean
35 endif
36
37 if ONLY_MOONLIGHT
38 build_profiles = moonlight_raw
39 test_profiles = moonlight_raw
40 else
41
42 build_profiles = 
43
44 if MOONLIGHT
45 build_profiles += moonlight_raw
46
47 moon-do-moonlight-raw: Makefile $(SUPPORT_FILES)
48         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='moonlight_raw' CC='$(CC)' all-profiles
49
50 moon-do-moonlight-raw-clean:
51         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='moonlight_raw' CC='$(CC)' clean-profiles
52
53 moon-do-build: moon-do-moonlight-raw moon-do-basic
54 moon-do-clean: moon-do-moonlight-raw-clean moon-do-basic-clean
55
56 endif
57
58 if INSTALL_2_0
59 build_profiles += net_2_0 net_3_5
60 al_profile = net_2_0
61 endif
62
63 if INSTALL_4_0
64 build_profiles += net_4_0
65 al_profile = net_4_0
66 endif
67
68 if INSTALL_4_5
69 build_profiles += net_4_5
70 al_profile = net_4_5
71 endif
72
73 if INSTALL_MONODROID
74 build_profiles += monodroid
75 endif
76
77 if INSTALL_MONOTOUCH
78 build_profiles += monotouch monotouch_runtime
79 endif
80
81 test_profiles = $(build_profiles)
82
83 endif
84
85 if BUILD_MCS
86
87 MAKE_FLAGS=$(if $(V),,--no-print-directory -s)
88
89 # The write check is to foil 'make distcheck'
90 all-local: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
91         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
92         cd $(mcs_topdir) && $(MAKE) $(MAKE_FLAGS) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
93
94 # override automake
95 install: install-exec install-data
96
97 # override automake
98 install-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
99         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
100
101 # override automake
102 install-data:
103         @:
104
105 # override automake
106 uninstall:
107         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
108
109 ## mono --wapi=semdel will probably not delete the semaphore if someone is crazy enough to do a 'make -j distclean' :-)
110 clean-local:
111         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
112         -./mono-wrapper --wapi=semdel
113         -rm -fr $(etctmp) $(tmpinst) .wapi
114
115 endif BUILD_MCS
116
117 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/mcs $(tmpinst)/bin/gmcs $(tmpinst)/bin/dmcs $(tmpinst)/bin/al2 $(tmpinst)/bin/al
118
119 # now a misnomer, but it'll go away soon enough.
120 if ENABLE_NUNIT_TESTS
121 test_select =
122 else
123 test_select = ONLY_CENTUM_TESTS=yes
124 endif
125
126 mcs-do-test-profiles:
127         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
128
129 mcs-do-run-test-profiles: test-support-files
130         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
131
132 if HOST_WIN32
133 if CROSS_COMPILING
134 cur_dir_cmd = pwd
135 PLATFORM_PATH_SEPARATOR = :
136 else
137 cur_dir_cmd = cygpath -w -a .
138 PLATFORM_PATH_SEPARATOR = ;
139 endif
140 else
141 cur_dir_cmd = pwd
142 PLATFORM_PATH_SEPARATOR = :
143 endif
144
145 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
146 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
147 # Skip net 4.0 assemblies because the contain metadata only
148 mcs-compileall: mono-wrapper etc/mono/config
149         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
150         for profile in $(test_profiles); do \
151           if [ "net_4_0" = "$$profile" ]; then \
152           continue; \
153       fi; \
154           if [ "net_3_5" = "$$profile" ]; then \
155                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
156           else \
157                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
158           fi; \
159           export MONO_PATH; \
160           for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
161                 if [ ! -f $$i ] ; then \
162                         continue ; \
163                 fi ;  \
164             if ./mono-wrapper --compile-all --verify-all --security=validil $$i; then \
165               echo $$i verified OK; \
166             else \
167               echo $$i verification failed; ok=false; \
168             fi; done; done; \
169         $$ok
170
171 check-local: mcs-compileall mcs-do-test-profiles
172         $(MAKE) $(test_select) mcs-do-run-test-profiles
173
174 # Compile all mcs tests
175 test: mcs-do-test-profiles
176
177 CLEANFILES = etc/mono/config
178
179 # depend on $(symlinks) to ensure 'etc/mono' directory exists
180 etc/mono/config: ../data/config Makefile $(symlinks)
181         d=`cd ../support && pwd`; \
182         sed 's,target="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@t
183         if test -z "$(libgdiplus_loc)"; then :; else \
184           sed 's,<configuration>,& <dllmap dll="gdiplus.dll" target="$(libgdiplus_loc)" />,' $@t > $@tt; \
185           mv -f $@tt $@t; fi
186         mv -f $@t $@
187
188 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
189         $(mkinstalldirs) $(tmpinst)/bin
190         cp mono-wrapper $@
191
192 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
193         echo '#! /bin/sh' > $@ ; \
194         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
195         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/build/mcs.exe"'" "$$@"' >> $@ ; \
196         chmod +x $@
197
198 $(tmpinst)/bin/gmcs: $(tmpinst)/bin/mono Makefile
199         echo '#! /bin/sh' > $@ ; \
200         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
201         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/build/mcs.exe -sdk:2"'" "$$@"' >> $@ ; \
202         chmod +x $@
203
204 $(tmpinst)/bin/dmcs: $(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/build/mcs.exe -sdk:4"'" "$$@"' >> $@ ; \
208         chmod +x $@
209
210 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
211         echo '#! /bin/sh' > $@ ; \
212         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
213         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
214         chmod +x $@
215
216 $(tmpinst)/bin/al2: $(tmpinst)/bin/mono Makefile
217         echo '#! /bin/sh' > $@ ; \
218         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
219         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/net_2_0/al.exe"'" "$$@"' >> $@ ; \
220         chmod +x $@
221
222 $(tmpinst)/bin/al: $(tmpinst)/bin/mono Makefile
223         echo '#! /bin/sh' > $@ ; \
224         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
225         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(al_profile)/al.exe"'" "$$@"' >> $@ ; \
226         chmod +x $@
227
228 test-support-files: $(TEST_SUPPORT_FILES)
229         @:
230
231 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
232 MYDISTFILES = $(DIST_COMMON)
233 distdir: $(MYDISTFILES)
234         rm -fr $(distdir)
235         mkdir $(distdir)
236         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
237           cp -p $$file $(distdir) ; done
238         find $(distdir) -type f -exec chmod a+r {} ';'