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