New test.
[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 semdel-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 
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
15 $(symlinks):
16         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
17
18 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
19
20 if INSTALL_2_0
21 build_profiles = default net_2_0
22 else
23 build_profiles = default
24 endif
25
26 if BUILD_MCS
27
28 # The write check is to foil 'make distcheck'
29 all-local: $(SUPPORT_FILES)
30         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
31         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
32
33 # override automake
34 install: install-exec install-data
35
36 # override automake
37 install-exec: $(SUPPORT_FILES)
38         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
39
40 # override automake
41 install-data:
42         @:
43
44 # override automake
45 uninstall:
46         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
47
48 ## semdel-wrapper will probably not delete the semaphore if someone is crazy enough to do a 'make -j distclean' :-)
49 clean-local:
50         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' clean-profiles
51         -./semdel-wrapper
52         -rm -fr $(etctmp) $(tmpinst) .wapi
53
54 endif BUILD_MCS
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 # now a misnomer, but it'll go away soon enough.
63 if ENABLE_NUNIT_TESTS
64 test_select =
65 else
66 test_select = ONLY_CENTUM_TESTS=yes
67 endif
68
69 mcs-do-test-profiles:
70         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' test-profiles
71
72 mcs-do-run-test-profiles: test-support-files
73         d=`cd $(tmpinst) && pwd`; PATH=$$d/bin:$$PATH ; export PATH ; \
74         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' run-test-profiles
75
76 if PLATFORM_WIN32
77 cur_dir_cmd = cygpath -w -a .
78 PLATFORM_PATH_SEPARATOR = ;
79 else
80 cur_dir_cmd = pwd
81 PLATFORM_PATH_SEPARATOR = :
82 endif
83
84 # Use --compile-all as a poor man's PEVerify to detect invalid IL
85 mcs-compileall: mono-wrapper etc/mono/config
86         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
87         for profile in $(build_profiles); do \
88           MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; export MONO_PATH; \
89           for i in $(mcs_topdir)/class/lib/$$profile/*.dll $(mcs_topdir)/class/lib/$$profile/*.exe; do \
90             if ./mono-wrapper --compile-all $$i; then \
91               echo $$i verified OK; \
92             else \
93               echo $$i verification failed; ok=false; \
94             fi; done; done; \
95         $$ok
96
97 check-local: mcs-compileall mcs-do-test-profiles
98         $(MAKE) $(test_select) mcs-do-run-test-profiles
99
100 CLEANFILES = etc/mono/config
101
102 # depend on $(symlinks) to ensure 'etc/mono' directory exists
103 etc/mono/config: ../data/config Makefile $(symlinks)
104         d=`cd ../support && pwd`; \
105         sed 's,target="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@t
106         if test -z "$(libgdiplus_loc)"; then :; else \
107           sed 's,<configuration>,& <dllmap dll="gdiplus.dll" target="$(libgdiplus_loc)" />,' $@t > $@tt; \
108           mv -f $@tt $@t; fi
109         mv -f $@t $@
110
111 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
112         cp mono-wrapper $@
113
114 $(tmpinst)/bin/mcs:
115         $(MAKE) test-support-file target=$@ file=class/lib/default/mcs.exe
116
117 $(tmpinst)/bin/mbas:
118         $(MAKE) test-support-file target=$@ file=mbas/mbas.exe
119
120 $(tmpinst)/bin/gmcs:
121         $(MAKE) test-support-file target=$@ file=gmcs/gmcs.exe
122
123 $(tmpinst)/bin/ilasm:
124         $(MAKE) test-support-file target=$@ file=ilasm/ilasm.exe
125
126 test-support-files:
127         $(mkinstalldirs) $(tmpinst)/bin
128         $(MAKE) $(TEST_SUPPORT_FILES)
129
130 test-support-file:
131         echo '#! /bin/sh' > $(target)
132         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; echo 'exec "'"$$r/mono-wrapper"'" "'"$$m/$(file)"'" "$$@"' >> $(target)
133         chmod +x $(target)
134
135 $(tmpinst)/bin/pedump: $(srcdir)/Makefile.am
136         $(mkdir_p) $(@D)
137         (b=`pwd`; echo '#! /bin/sh'; echo 'exec "'"$$b/libtool"'" --mode=execute "'"$$b/mono/metadata/pedump"'" "$$@"') > $@
138         chmod +x $@
139
140 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
141 MYDISTFILES = $(DIST_COMMON)
142 distdir: $(MYDISTFILES)
143         rm -fr $(distdir)
144         mkdir $(distdir)
145         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
146           cp -p $$file $(distdir) ; done
147         find $(distdir) -type f -exec chmod a+r {} ';'