21de2a95960905bbcf33fbf8eb5f867e64adb9c2
[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/config etc/mono/1.0/machine.config etc/mono/2.0/machine.config etc/mono/2.0/web.config 
10
11 etc/mono/config            : $(top_srcdir)/data/config
12 etc/mono/1.0/machine.config: $(top_srcdir)/data/net_1_1/machine.config
13 etc/mono/2.0/machine.config: $(top_srcdir)/data/net_2_0/machine.config
14 etc/mono/2.0/web.config: $(top_srcdir)/data/net_2_0/web.config
15
16 $(symlinks):
17         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
18
19 SUPPORT_FILES = $(symlinks) mono-wrapper wrapper-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)
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)
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 if INSTALL_2_0
58 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm $(tmpinst)/bin/gmcs
59 else
60 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/bin/mbas $(tmpinst)/bin/ilasm
61 endif
62
63 # now a misnomer, but it'll go away soon enough.
64 if ENABLE_NUNIT_TESTS
65 test_select =
66 else
67 test_select = ONLY_CENTUM_TESTS=yes
68 endif
69
70 mcs-do-test-profiles:
71         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' test-profiles
72
73 mcs-do-run-test-profiles: test-support-files
74         d=`cd $(tmpinst) && pwd`; PATH=$$d/bin:$$PATH ; export PATH ; \
75         cd $(mcs_topdir) && $(MAKE) PROFILES='$(build_profiles)' run-test-profiles
76
77 if PLATFORM_WIN32
78 cur_dir_cmd = cygpath -w -a .
79 PLATFORM_PATH_SEPARATOR = ;
80 else
81 cur_dir_cmd = pwd
82 PLATFORM_PATH_SEPARATOR = :
83 endif
84
85 # Use --compile-all as a poor man's PEVerify to detect invalid IL
86 mcs-compileall: mono-wrapper wrapper-config
87         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
88         for profile in $(build_profiles); do \
89           MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; export MONO_PATH; \
90           for i in $(mcs_topdir)/class/lib/$$profile/*.dll $(mcs_topdir)/class/lib/$$profile/*.exe; do \
91             if ./mono-wrapper --compile-all $$i; then \
92               echo $$i verified OK; \
93             else \
94               echo $$i verification failed; ok=false; \
95             fi; done; done; \
96         $$ok
97
98 check-local: mcs-compileall mcs-do-test-profiles
99         $(MAKE) $(test_select) mcs-do-run-test-profiles
100
101 CLEANFILES = wrapper-config
102
103 wrapper-config: ../data/config Makefile
104         d=`cd ../support && pwd`; \
105         sed 's,target="libMonoPosixHelper[^"]*",target="'$$d/libMonoPosixHelper.la'",' ../data/config > $@
106         if test -z "$(libgdiplus_loc)"; then :; else \
107           mv $@ $@t; \
108           sed 's,<configuration>,& <dllmap dll="gdiplus.dll" target="$(libgdiplus_loc)" />,' $@t > $@; \
109           rm -f $@t; \
110         fi
111
112 $(tmpinst)/bin/mono: mono-wrapper wrapper-config
113         cp mono-wrapper $@
114
115 $(tmpinst)/bin/mcs:
116         $(MAKE) test-support-file target=$@ file=class/lib/default/mcs.exe
117
118 $(tmpinst)/bin/mbas:
119         $(MAKE) test-support-file target=$@ file=mbas/mbas.exe
120
121 $(tmpinst)/bin/gmcs:
122         $(MAKE) test-support-file target=$@ file=gmcs/gmcs.exe
123
124 $(tmpinst)/bin/ilasm:
125         $(MAKE) test-support-file target=$@ file=ilasm/ilasm.exe
126
127 test-support-files:
128         $(mkinstalldirs) $(tmpinst)/bin
129         $(MAKE) $(TEST_SUPPORT_FILES)
130
131 test-support-file:
132         echo '#! /bin/sh' > $(target)
133         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; echo 'exec "'"$$r/mono-wrapper"'" "'"$$m/$(file)"'" "$$@"' >> $(target)
134         chmod +x $(target)
135
136 $(tmpinst)/bin/pedump: $(srcdir)/Makefile.am
137         $(mkdir_p) $(@D)
138         (b=`pwd`; echo '#! /bin/sh'; echo 'exec "'"$$b/libtool"'" --mode=execute "'"$$b/mono/metadata/pedump"'" "$$@"') > $@
139         chmod +x $@
140
141 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
142 MYDISTFILES = $(DIST_COMMON)
143 distdir: $(MYDISTFILES)
144         rm -fr $(distdir)
145         mkdir $(distdir)
146         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
147           cp -p $$file $(distdir) ; done
148         find $(distdir) -type f -exec chmod a+r {} ';'