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