Merge pull request #2831 from razzfazz/fix_dllimport
[mono.git] / runtime / Makefile.am
1 tmpinst = _tmpinst
2
3 noinst_SCRIPTS = mono-wrapper monodis-wrapper
4
5 etctmp = etc
6 symlinks = etc/mono/1.0/machine.config etc/mono/2.0/machine.config etc/mono/2.0/web.config etc/mono/browscap.ini etc/mono/2.0/Browsers/Compat.browser
7
8 if INSTALL_4_x
9 symlinks += etc/mono/4.0/machine.config etc/mono/4.0/web.config etc/mono/4.5/web.config etc/mono/4.5/machine.config etc/mono/4.0/Browsers/Compat.browser etc/mono/4.5/Browsers/Compat.browser
10 endif
11
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 etc/mono/2.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
16 etc/mono/4.0/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
17 etc/mono/4.5/Browsers/Compat.browser: $(top_srcdir)/data/Browsers/Compat.browser
18 etc/mono/4.0/machine.config: $(top_srcdir)/data/net_4_0/machine.config
19 etc/mono/4.0/web.config: $(top_srcdir)/data/net_4_0/web.config
20 etc/mono/4.5/machine.config: $(top_srcdir)/data/net_4_5/machine.config
21 etc/mono/4.5/web.config: $(top_srcdir)/data/net_4_5/web.config
22
23 $(symlinks):
24         cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
25
26 SUPPORT_FILES = $(symlinks) mono-wrapper etc/mono/config
27
28 build_profiles = 
29
30 if INSTALL_4_x
31 build_profiles += binary_reference_assemblies net_4_x xbuild_12 xbuild_14
32 al_profile = net_4_x
33 endif
34
35 if INSTALL_MONODROID
36 build_profiles += monodroid
37 endif
38
39 if INSTALL_MONOTOUCH
40 build_profiles += monotouch monotouch_runtime
41 endif
42
43 if INSTALL_MONOTOUCH_WATCH
44 build_profiles += monotouch_watch monotouch_watch_runtime
45 endif
46
47 if INSTALL_MONOTOUCH_TV
48 build_profiles += monotouch_tv monotouch_tv_runtime
49 endif
50
51 if INSTALL_MOBILE_STATIC
52 build_profiles += mobile_static
53 endif
54
55 if INSTALL_XAMMAC
56 build_profiles += xammac xammac_net_4_5
57 endif
58
59 test_profiles = $(build_profiles)
60
61 if BUILD_MCS
62
63 MAKE_FLAGS=$(if $(V),,--no-print-directory -s)
64
65 # The write check is to foil 'make distcheck'
66 all-local: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
67         if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
68         cd $(mcs_topdir) && $(MAKE) $(MAKE_FLAGS) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
69
70 # override automake
71 install: install-exec install-data
72
73 # override automake
74 install-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
75         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
76
77 # override automake
78 install-data:
79         @:
80
81 # override automake
82 uninstall:
83         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
84
85 clean-local:
86         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
87         -rm -fr $(etctmp) $(tmpinst)
88
89 endif BUILD_MCS
90
91 TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/mcs $(tmpinst)/bin/al
92
93 mcs-do-test-profiles:
94         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' test-profiles
95
96 mcs-do-run-test-profiles: test-support-files
97         cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(test_profiles)' run-test-profiles
98
99 if HOST_WIN32
100 if CROSS_COMPILING
101 cur_dir_cmd = pwd
102 PLATFORM_PATH_SEPARATOR = :
103 else
104 cur_dir_cmd = cygpath -w -a .
105 PLATFORM_PATH_SEPARATOR = ;
106 endif
107 else
108 cur_dir_cmd = pwd
109 PLATFORM_PATH_SEPARATOR = :
110 endif
111
112 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
113 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
114 # Skip binary_reference_assemblies because they contain metadata only
115 mcs-compileall: mono-wrapper etc/mono/config
116         save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
117         for profile in $(test_profiles); do \
118           if [ "binary_reference_assemblies" = "$$profile" ]; then \
119           continue; \
120       fi; \
121           if [ "xbuild_12" = "$$profile" ]; then \
122                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
123           elif [ "xbuild_14" = "$$profile" ]; then \
124                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
125           else \
126                   MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
127           fi; \
128           export MONO_PATH; \
129           for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
130                 if [ ! -f $$i ] ; then \
131                         continue ; \
132                 fi ;  \
133             if ./mono-wrapper --compile-all --verify-all --security=verifiable $$i; then \
134               echo $$i verified OK; \
135             else \
136               echo $$i verification failed; ok=false; \
137             fi; done; done; \
138         $$ok
139
140 if NACL_CODEGEN
141 check-local:
142 else
143 check-local: mcs-compileall mcs-do-test-profiles
144         $(MAKE) mcs-do-run-test-profiles
145 endif
146
147 # Compile all mcs tests
148 test: mcs-do-test-profiles
149
150 CLEANFILES = etc/mono/config
151
152 # depend on $(symlinks) to ensure 'etc/mono' directory exists
153 etc/mono/config: ../data/config Makefile $(symlinks)
154         d=`cd ../support && pwd`; \
155         sed 's,target="$$mono_libdir/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
156         if test -z "$(libgdiplus_loc)"; then :; else \
157           sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@t > $@tt; \
158           mv -f $@tt $@t; fi
159         mv -f $@t $@
160
161 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
162         $(mkinstalldirs) $(tmpinst)/bin
163         cp mono-wrapper $@
164
165 $(tmpinst)/bin/mcs: $(tmpinst)/bin/mono Makefile
166         echo '#! /bin/sh' > $@ ; \
167         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
168         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/build/mcs.exe"'" "$$@"' >> $@ ; \
169         chmod +x $@
170
171 $(tmpinst)/bin/ilasm: $(tmpinst)/bin/mono Makefile
172         echo '#! /bin/sh' > $@ ; \
173         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
174         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/ilasm/ilasm.exe"'" "$$@"' >> $@ ; \
175         chmod +x $@
176
177 $(tmpinst)/bin/al: $(tmpinst)/bin/mono Makefile
178         echo '#! /bin/sh' > $@ ; \
179         r=`pwd`; m=`cd $(mcs_topdir) && pwd`; \
180         echo 'exec "'"$$r/$(tmpinst)/bin/mono"'" "'"$$m/class/lib/$(al_profile)/al.exe"'" "$$@"' >> $@ ; \
181         chmod +x $@
182
183 test-support-files: $(TEST_SUPPORT_FILES)
184         @:
185
186 # the 'cygnus' option also disables the default 'distdir:' target, which we _do_ want
187 MYDISTFILES = $(DIST_COMMON)
188 distdir: $(MYDISTFILES)
189         rm -fr $(distdir)
190         mkdir $(distdir)
191         test -z '$(MYDISTFILES)' || for file in ''$(MYDISTFILES); do \
192           cp -p $$file $(distdir) ; done
193         find $(distdir) -type f -exec chmod a+r {} ';'