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