Merge branch 'master' of github.com:mono/mono
[mono.git] / runtime / Makefile.am
1 # hack to prevent 'check' from depending on 'all'
2 AUTOMAKE_OPTIONS = cygnus
3
4 tmpinst = _tmpinst
5
6 noinst_SCRIPTS = mono-wrapper monodis-wrapper
7
8 etctmp = etc
9 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
10
11 if INSTALL_4_0
12 symlinks += etc/mono/4.0/machine.config etc/mono/4.0/web.config
13 endif
14
15 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
16 etc/mono/2.0/web.config: $(top_srcdir)/data/net_2_0/web.config
17 etc/mono/browscap.ini: $(top_srcdir)/data/browscap.ini
18 etc/mono/2.0/Browsers/Compat.browser: $(top_srcdir)/data/net_2_0/Browsers/Compat.browser
19 etc/mono/4.0/machine.config: $(top_srcdir)/data/net_4_0/machine.config
20 etc/mono/4.0/web.config: $(top_srcdir)/data/net_4_0/web.config
21
22 $(symlinks):
23         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
24
25 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
26
27 if ONLY_MOONLIGHT
28 build_profiles = moonlight_raw
29 test_profiles = moonlight_raw
30 else
31
32 build_profiles = net_2_0 net_3_5
33 test_profiles = $(build_profiles)
34
35 if MOONLIGHT
36 build_profiles += moonlight_raw
37 test_profiles += moonlight_raw
38 endif
39
40 if INSTALL_4_0
41 build_profiles += net_4_0
42 #test_profiles += net_4_0
43 endif
44
45 if INSTALL_MONODROID
46 build_profiles += monodroid
47 endif
48
49 if INSTALL_MONOTOUCH
50 build_profiles += monotouch
51 endif
52
53 endif
54
55 if BUILD_MCS
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) 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 ## mono --wapi=semdel will probably not delete the semaphore if someone is crazy enough to do a 'make -j distclean' :-)
78 clean-local:
79         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
80         -./mono-wrapper --wapi=semdel
81         -rm -fr $(etctmp) $(tmpinst) .wapi
82
83 endif BUILD_MCS
84
85 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/gmcs $(tmpinst)/bin/dmcs $(tmpinst)/bin/al2
86
87 # now a misnomer, but it'll go away soon enough.
88 if ENABLE_NUNIT_TESTS
89 test_select =
90 else
91 test_select = ONLY_CENTUM_TESTS=yes
92 endif
93
94 mcs-do-test-profiles:
95         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
96
97 mcs-do-run-test-profiles: test-support-files
98         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
99
100 if HOST_WIN32
101 if CROSS_COMPILING
102 cur_dir_cmd = pwd
103 PLATFORM_PATH_SEPARATOR = :
104 else
105 cur_dir_cmd = cygpath -w -a .
106 PLATFORM_PATH_SEPARATOR = ;
107 endif
108 else
109 cur_dir_cmd = pwd
110 PLATFORM_PATH_SEPARATOR = :
111 endif
112
113 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
114 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
115 # Skip net 2.1 assemblies for now because of visibility problems
116 mcs-compileall: mono-wrapper etc/mono/config
117         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
118         for profile in $(test_profiles); do \
119           if [ "moonlight" = "$$profile" ]; then \
120           break; \
121       fi; \
122           if [ "net_3_5" = "$$profile" ]; then \
123                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
124           else \
125                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
126           fi; \
127           export MONO_PATH; \
128           for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
129                 if [ ! -f $$i ] ; then \
130                         continue ; \
131                 fi ;  \
132             if ./mono-wrapper --compile-all --verify-all --security=validil $$i; then \
133               echo $$i verified OK; \
134             else \
135               echo $$i verification failed; ok=false; \
136             fi; done; done; \
137         $$ok
138
139 check-local: mcs-compileall mcs-do-test-profiles
140         $(MAKE) $(test_select) mcs-do-run-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="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@t
148         if test -z "$(libgdiplus_loc)"; then :; else \
149           sed 's,<configuration>,& <dllmap dll="gdiplus.dll" 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/gmcs: $(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/net_2_0/gmcs.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/net_4_0/dmcs.exe"'" "$$@"' >> $@ ; \
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 test-support-files: $(TEST_SUPPORT_FILES)
182         @:
183
184 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
185 MYDISTFILES = $(DIST_COMMON)
186 distdir: $(MYDISTFILES)
187         rm -fr $(distdir)
188         mkdir $(distdir)
189         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
190           cp -p $$file $(distdir) ; done
191         find $(distdir) -type f -exec chmod a+r {} ';'