2005-02-21 Kazuki Oikawa <kazuki@panicode.com>
[mono.git] / runtime / Makefile.am
1 # This is just used to copy and install the DLL files that are currently
2 # being compiled on windows.
3 #
4
5 # hack to prevent 'check' from depending on 'all'
6 AUTOMAKE_OPTIONS = cygnus
7
8 tmpinst = _tmpinst
9
10 noinst_SCRIPTS = mono-wrapper
11
12 symlinks = etc/mono/1.0/machine.config etc/mono/2.0/machine.config
13
14 etc/mono/1.0/machine.config: $(top_srcdir)/data/net_1_1/machine.config
15 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
16
17 $(symlinks):
18         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
19
20 # The write check is to foil 'make distcheck'
21 all-local: $(symlinks) mono-wrapper wrapper-config
22         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
23         d=`pwd`; cd $(mcs_topdir) && $(MAKE) RUNTIME=$$d/mono-wrapper PROFILES='$(build_profiles)' all-profiles
24
25 if INSTALL_2_0
26 build_profiles = default net_2_0
27 clean_profiles = basic net_1_1_bootstrap default net_2_0_bootstrap net_2_0
28 else
29 build_profiles = default
30 clean_profiles = basic net_1_1_bootstrap default
31 endif
32
33 # override automake
34 install: install-exec install-data
35
36 # override automake
37 install-exec:
38         d=`pwd`; \
39         cd $(mcs_topdir) && $(MAKE) prefix='$(exec_prefix)' PROFILES='$(build_profiles)' \
40                                     RUNTIME=$$d/mono-wrapper RUNTIME_HAS_CONSISTENT_GACDIR=yes install-profiles
41
42 # override automake
43 install-data:
44         @:
45
46 # override automake
47 uninstall:
48         d=`pwd`; \
49         cd $(mcs_topdir) && $(MAKE) prefix='$(exec_prefix)' PROFILES='$(build_profiles)' \
50                                     RUNTIME=$$d/mono-wrapper RUNTIME_HAS_CONSISTENT_GACDIR=yes uninstall-profiles
51
52 clean-local:
53         d=`pwd`; cd $(mcs_topdir) && $(MAKE) PROFILES='$(clean_profiles)' clean-profiles
54         -rm -fr $(symlinks) $(tmpinst) .wapi
55
56 if INSTALL_2_0
57 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm $(tmpinst)/bin/gmcs
58 else
59 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm
60 endif
61
62 # List of NUnit testcases that should be 100% pass
63 centum_nunit_tests = \
64         class/corlib \
65         class/Commons.Xml.Relaxng \
66         class/Cscompmgd \
67         class/Microsoft.JScript \
68         class/Mono.Posix \
69         class/Mono.Security \
70         class/System \
71         class/System.Configuration.Install \
72         class/System.Runtime.Remoting \
73         class/System.Runtime.Serialization.Formatters.Soap \
74         class/System.Web.Services
75
76 # now a misnomer, but it'll go away soon enough.
77 if ENABLE_NUNIT_TESTS
78 test_select =
79 else
80 test_select = TEST_SUBDIRS='$(centum_nunit_tests) tests errors'
81 endif
82
83 mcs-do-test-profiles:
84         d=`pwd`; cd $(mcs_topdir) && $(MAKE) RUNTIME=$$d/mono-wrapper PROFILES='$(build_profiles)' test-profiles
85
86 mcs-do-run-test-profiles: test-support-files
87         d=`pwd`; PATH=$$d/$(tmpinst)/bin:$$PATH ; export PATH ; \
88         ( cd $(mcs_topdir) && $(MAKE) RUNTIME=$$d/mono-wrapper PROFILES='$(build_profiles)' run-test-profiles ) || ret=false ; \
89         rm -fr $(tmpinst); $$ret
90
91 if PLATFORM_WIN32
92 cur_dir_cmd = cygpath -w -a .
93 PLATFORM_PATH_SEPARATOR = ;
94 else
95 cur_dir_cmd = pwd
96 PLATFORM_PATH_SEPARATOR = :
97 endif
98
99 # Use --compile-all as a poor man's PEVerify to detect invalid IL
100 mcs-compileall: mono-wrapper wrapper-config
101         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ret=:; \
102         for profile in $(build_profiles); do \
103           MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; export MONO_PATH; \
104           for i in $(mcs_topdir)/class/lib/$$profile/*.dll $(mcs_topdir)/class/lib/$$profile/*.exe; do \
105             if ./mono-wrapper --compile-all $$i; then \
106               echo $$i verified OK; \
107             else \
108               echo $$i verification failed; ret=false; \
109             fi; done; done; \
110         $$ret
111
112 check-local: mcs-compileall mcs-do-test-profiles
113         $(MAKE) $(test_select) mcs-do-run-test-profiles
114
115 wrapper-config: ../data/config
116         d=`cd ../support && pwd`; \
117         sed 's,target="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@
118
119 $(tmpinst)/bin/mono: mono-wrapper wrapper-config
120         cp mono-wrapper $@
121
122 $(tmpinst)/bin/mcs:
123         $(MAKE) test-support-file target=$@ file=class/lib/default/mcs.exe
124
125 $(tmpinst)/bin/mbas:
126         $(MAKE) test-support-file target=$@ file=mbas/mbas.exe
127
128 $(tmpinst)/bin/gmcs:
129         $(MAKE) test-support-file target=$@ file=gmcs/gmcs.exe
130
131 $(tmpinst)/bin/ilasm:
132         $(MAKE) test-support-file target=$@ file=ilasm/ilasm.exe
133
134 test-support-files:
135         $(mkinstalldirs) $(tmpinst)/bin
136         $(MAKE) $(TEST_SUPPORT_FILES)
137
138 test-support-file:
139         echo '#! /bin/sh' > $(target)
140         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; echo 'exec "'"$$r/mono-wrapper"'" "'"$$m/$(file)"'" "$$@"' >> $(target)
141         chmod +x $(target)
142
143 $(tmpinst)/bin/pedump: $(srcdir)/Makefile.am
144         $(mkdir_p) $(@D)
145         (b=`pwd`; echo '#! /bin/sh'; echo 'exec "'"$$b/libtool"'" --mode=execute "'"$$b/mono/metadata/pedump"'" "$$@"') > $@
146         chmod +x $@
147
148 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
149 MYDISTFILES = Makefile.am Makefile.in mono-wrapper.in
150 distdir: $(MYDISTFILES)
151         rm -fr $(distdir)
152         mkdir $(distdir)
153         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
154           if test -f $$file; then d=.; else d=$(srcdir); fi; \
155           cp -p $$d/$$file $(distdir) ; done
156         find $(distdir) -type f -exec chmod a+r {} ';'