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