Merge pull request #1684 from Garciat/fix-zlib-helper
[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 += binary_reference_assemblies 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 clean-local:
83         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
84         -rm -fr $(etctmp) $(tmpinst)
85
86 endif BUILD_MCS
87
88 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/mcs $(tmpinst)/bin/dmcs $(tmpinst)/bin/al2 $(tmpinst)/bin/al
89
90 mcs-do-test-profiles:
91         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
92
93 mcs-do-run-test-profiles: test-support-files
94         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
95
96 if HOST_WIN32
97 if CROSS_COMPILING
98 cur_dir_cmd = pwd
99 PLATFORM_PATH_SEPARATOR = :
100 else
101 cur_dir_cmd = cygpath -w -a .
102 PLATFORM_PATH_SEPARATOR = ;
103 endif
104 else
105 cur_dir_cmd = pwd
106 PLATFORM_PATH_SEPARATOR = :
107 endif
108
109 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
110 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
111 # Skip binary_reference_assemblies because they contain metadata only
112 mcs-compileall: mono-wrapper etc/mono/config
113         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
114         for profile in $(test_profiles); do \
115           if [ "binary_reference_assemblies" = "$$profile" ]; then \
116           continue; \
117       fi; \
118           if [ "xbuild_12" = "$$profile" ]; then \
119                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_5$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
120           elif [ "xbuild_14" = "$$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           else \
123                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
124           fi; \
125           export MONO_PATH; \
126           for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
127                 if [ ! -f $$i ] ; then \
128                         continue ; \
129                 fi ;  \
130             if ./mono-wrapper --compile-all --verify-all --security=verifiable $$i; then \
131               echo $$i verified OK; \
132             else \
133               echo $$i verification failed; ok=false; \
134             fi; done; done; \
135         $$ok
136
137 if NACL_CODEGEN
138 check-local:
139 else
140 check-local: mcs-compileall mcs-do-test-profiles
141         $(MAKE) mcs-do-run-test-profiles
142 endif
143
144 # Compile all mcs tests
145 test: mcs-do-test-profiles
146
147 CLEANFILES = etc/mono/config
148
149 # depend on $(symlinks) to ensure 'etc/mono' directory exists
150 etc/mono/config: ../data/config Makefile $(symlinks)
151         d=`cd ../support && pwd`; \
152         sed 's,target="$(prefix)/$(reloc_libdir)/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
153         if test -z "$(libgdiplus_loc)"; then :; else \
154           sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@t > $@tt; \
155           mv -f $@tt $@t; fi
156         mv -f $@t $@
157
158 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
159         $(mkinstalldirs) $(tmpinst)/bin
160         cp mono-wrapper $@
161
162 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
163         echo '#! /bin/sh' > $@ ; \
164         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
165         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/build/mcs.exe"'" "$$@"' >> $@ ; \
166         chmod +x $@
167
168 $(tmpinst)/bin/dmcs: $(tmpinst)/bin/mono Makefile
169         echo '#! /bin/sh' > $@ ; \
170         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
171         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/build/mcs.exe -sdk:4"'" "$$@"' >> $@ ; \
172         chmod +x $@
173
174 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
175         echo '#! /bin/sh' > $@ ; \
176         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
177         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
178         chmod +x $@
179
180 $(tmpinst)/bin/al2: $(tmpinst)/bin/mono Makefile
181         echo '#! /bin/sh' > $@ ; \
182         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
183         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/net_2_0/al.exe"'" "$$@"' >> $@ ; \
184         chmod +x $@
185
186 $(tmpinst)/bin/al: $(tmpinst)/bin/mono Makefile
187         echo '#! /bin/sh' > $@ ; \
188         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
189         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(al_profile)/al.exe"'" "$$@"' >> $@ ; \
190         chmod +x $@
191
192 test-support-files: $(TEST_SUPPORT_FILES)
193         @:
194
195 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
196 MYDISTFILES = $(DIST_COMMON)
197 distdir: $(MYDISTFILES)
198         rm -fr $(distdir)
199         mkdir $(distdir)
200         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
201           cp -p $$file $(distdir) ; done
202         find $(distdir) -type f -exec chmod a+r {} ';'