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