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