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