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