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