Merge pull request #4212 from BrzVlad/fix-ephemeron-leak
[mono.git] / mcs / build / profiles / basic.make
1 # -*- makefile -*-
2
3 with_mono_path_monolite = MONO_PATH="$(topdir)/class/lib/monolite$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/monolite/Facades$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
4
5 monolite_flag := $(depsdir)/use-monolite
6 use_monolite := $(wildcard $(monolite_flag))
7
8 MONOLITE_MSCORLIB = $(topdir)/class/lib/monolite/mscorlib.dll
9
10 ifdef use_monolite
11 ifdef MCS_MODE
12         CSC_LOCATION = $(topdir)/class/lib/monolite/mcs.exe
13 endif
14
15 PROFILE_RUNTIME = $(with_mono_path_monolite) $(RUNTIME)
16 BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
17
18 else
19 PROFILE_RUNTIME = $(EXTERNAL_RUNTIME)
20 ifdef MCS_MODE
21         BOOTSTRAP_MCS = mcs
22 else
23         BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
24 endif
25 endif
26
27 MCS = $(BOOTSTRAP_MCS)
28
29 DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
30
31 PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES)
32 NO_SIGN_ASSEMBLY = yes
33 NO_TEST = yes
34 NO_INSTALL = yes
35 FRAMEWORK_VERSION = 4.0
36
37 # Compiler all using same bootstrap compiler
38 LIBRARY_COMPILE = $(BOOT_COMPILE)
39
40 # Verbose basic only
41 # V = 1
42
43 #
44 # Copy from rules.make because I don't know how to unset MCS_FLAGS
45 #
46 USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS)
47
48 .PHONY: profile-check do-profile-check
49 profile-check:
50         @:
51
52 ifeq (.,$(thisdir))
53 all-recursive: do-profile-check
54 all-local: post-profile-cleanup
55 clean-local: clean-profile
56 endif
57
58 clean-profile:
59         -rm -f $(PROFILE_EXE) $(PROFILE_OUT) $(monolite_flag)
60
61 post-profile-cleanup:
62         @rm -f $(monolite_flag)
63
64 PROFILE_EXE = $(depsdir)/basic-profile-check.exe
65 PROFILE_OUT = $(PROFILE_EXE:.exe=.out)
66
67 MAKE_Q=$(if $(V),,-s)
68
69 do-profile-check: $(depsdir)/.stamp
70         @ok=:; \
71         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
72         if [ -z '$(MAKE_Q)' ] && [ -n '$(PROFILE_RUNTIME)' ]; then $(PROFILE_RUNTIME) --version; fi; \
73         $(MAKE) $(MAKE_Q) $(PROFILE_OUT) || ok=false; \
74         if $$ok; then rm -f $(PROFILE_EXE) $(PROFILE_OUT); else \
75             if test ! -s $(MONOLITE_MSCORLIB); then \
76                         $(MAKE) $(MAKE_Q) do-get-monolite ; \
77                 fi; \
78             if test -f $(MONOLITE_MSCORLIB); then \
79                 $(MAKE) $(MAKE_Q) do-profile-check-monolite ; \
80             else \
81                 echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2; \
82                 echo "*** You need Mono version 4.8 or better installed to build MCS" 1>&2 ; \
83                 echo "*** Check mono README for information on how to bootstrap a Mono installation." 1>&2 ; \
84                 exit 1; fi; fi
85
86
87 ifdef use_monolite
88
89 do-get-monolite:
90
91 do-profile-check-monolite:
92         @echo "*** The contents of your 'monolite' directory may be out-of-date" 1>&2
93         @echo "*** You may want to try 'make get-monolite-latest'" 1>&2
94         rm -f $(monolite_flag)
95         exit 1
96
97 else
98
99 do-get-monolite:
100         @echo "*** Downloading bootstrap required 'monolite'" 1>&2
101         $(MAKE) $(MAKE_Q) -C $(mono_build_root) get-monolite-latest
102
103 do-profile-check-monolite: $(depsdir)/.stamp
104         @echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2
105         @echo "*** Trying the 'monolite' directory." 1>&2
106         @echo dummy > $(monolite_flag)
107         $(MAKE) do-profile-check
108
109 endif
110
111 $(PROFILE_EXE): $(topdir)/build/common/basic-profile-check.cs
112         $(MAKE) $(MAKE_Q) -C $(topdir)/packages
113         $(BOOTSTRAP_MCS) /warn:0 /noconfig /r:System.dll /r:mscorlib.dll /out:$@ $<
114
115 $(PROFILE_OUT): $(PROFILE_EXE)
116         $(PROFILE_RUNTIME) $< > $@ 2>&1