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