2009-06-10 Marek Safar <marek.safar@gmail.com>
[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 etc/mono/1.0/machine.config: $(top_srcdir)/data/net_1_1/machine.config
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/net_2_0/Browsers/Compat.browser
16
17 $(symlinks):
18         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
19
20 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
21
22 build_profiles = net_1_1
23 test_profiles = $(build_profiles)
24
25 if INSTALL_2_0
26 build_profiles += net_2_0 net_3_5
27 test_profiles += net_2_0 net_3_5
28 endif
29
30 if INSTALL_4_0
31 build_profiles += net_4_0
32 #test_profiles += net_4_0
33 endif
34
35 if INSTALL_2_1
36 build_profiles += net_2_1_raw
37 test_profiles += net_2_1_raw
38 endif
39
40 if BUILD_MCS
41
42 # The write check is to foil 'make distcheck'
43 all-local: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
44         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
45         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
46
47 # override automake
48 install: install-exec install-data
49
50 # override automake
51 install-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
52         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
53
54 # override automake
55 install-data:
56         @:
57
58 # override automake
59 uninstall:
60         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
61
62 ## mono --wapi=semdel will probably not delete the semaphore if someone is crazy enough to do a 'make -j distclean' :-)
63 clean-local:
64         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
65         -./mono-wrapper --wapi=semdel
66         -rm -fr $(etctmp) $(tmpinst) .wapi
67
68 endif BUILD_MCS
69
70 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/bin/ilasm $(tmpinst)/bin/gmcs
71
72 # now a misnomer, but it'll go away soon enough.
73 if ENABLE_NUNIT_TESTS
74 test_select =
75 else
76 test_select = ONLY_CENTUM_TESTS=yes
77 endif
78
79 if INSTALL_2_1
80 moon-do-build: test-support-files
81         cd $(top_builddir)/../moon/class && $(MAKE) all
82 else
83 moon-do-build:
84         @:
85 endif
86
87 mcs-do-test-profiles:
88         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
89
90 mcs-do-run-test-profiles: test-support-files
91         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
92
93 if PLATFORM_WIN32
94 if CROSS_COMPILING
95 cur_dir_cmd = pwd
96 PLATFORM_PATH_SEPARATOR = :
97 else
98 cur_dir_cmd = cygpath -w -a .
99 PLATFORM_PATH_SEPARATOR = ;
100 endif
101 else
102 cur_dir_cmd = pwd
103 PLATFORM_PATH_SEPARATOR = :
104 endif
105
106 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
107 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
108 # Skip net 2.1 assemblies for now because of visibility problems
109 mcs-compileall: mono-wrapper etc/mono/config
110         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
111         for profile in $(test_profiles); do \
112           if [ "net_2_1" = "$$profile" ]; then \
113           break; \
114       fi; \
115           if [ "net_3_5" = "$$profile" ]; then \
116                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_2_0$(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=validil $$i; then \
126               echo $$i verified OK; \
127             else \
128               echo $$i verification failed; ok=false; \
129             fi; done; done; \
130         $$ok
131
132 check-local: mcs-compileall mcs-do-test-profiles
133         $(MAKE) $(test_select) mcs-do-run-test-profiles
134
135 CLEANFILES = etc/mono/config
136
137 # depend on $(symlinks) to ensure 'etc/mono' directory exists
138 etc/mono/config: ../data/config Makefile $(symlinks)
139         d=`cd ../support && pwd`; \
140         sed 's,target="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@t
141         if test -z "$(libgdiplus_loc)"; then :; else \
142           sed 's,<configuration>,& <dllmap dll="gdiplus.dll" target="$(libgdiplus_loc)" />,' $@t > $@tt; \
143           mv -f $@tt $@t; fi
144         mv -f $@t $@
145
146 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
147         $(mkinstalldirs) $(tmpinst)/bin
148         cp mono-wrapper $@
149
150 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
151         echo '#! /bin/sh' > $@ ; \
152         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
153         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/net_1_1/mcs.exe"'" "$$@"' >> $@ ; \
154         chmod +x $@
155
156 $(tmpinst)/bin/gmcs: $(tmpinst)/bin/mono Makefile
157         echo '#! /bin/sh' > $@ ; \
158         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
159         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/net_2_0/gmcs.exe"'" "$$@"' >> $@ ; \
160         chmod +x $@
161
162 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
163         echo '#! /bin/sh' > $@ ; \
164         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
165         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
166         chmod +x $@
167
168 test-support-files: $(TEST_SUPPORT_FILES)
169         @:
170
171 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
172 MYDISTFILES = $(DIST_COMMON)
173 distdir: $(MYDISTFILES)
174         rm -fr $(distdir)
175         mkdir $(distdir)
176         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
177           cp -p $$file $(distdir) ; done
178         find $(distdir) -type f -exec chmod a+r {} ';'