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