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