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