merge r67228-r67235, r67237, r67251 and r67256-67259 to trunk (they are
[mono.git] / mcs / build / profiles / basic.make
1 # -*- makefile -*-
2
3 with_mono_path = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
4 with_mono_path_monolite = MONO_PATH="$(topdir)/class/lib/monolite$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
5
6 monolite_flag := $(topdir)/build/deps/use-monolite
7 use_monolite := $(wildcard $(monolite_flag))
8
9 ifdef use_monolite
10 PROFILE_RUNTIME = $(with_mono_path_monolite) $(RUNTIME)
11 BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/monolite/mcs.exe
12 else
13 PROFILE_RUNTIME = $(EXTERNAL_RUNTIME)
14 BOOTSTRAP_MCS = $(EXTERNAL_MCS)
15 endif
16
17 MCS = $(with_mono_path) $(INTERNAL_MCS)
18
19 PROFILE_MCS_FLAGS = -d:NET_1_1 -d:ONLY_1_1 -d:BOOTSTRAP_WITH_OLDLIB
20 NO_SIGN_ASSEMBLY = yes
21 NO_TEST = yes
22 NO_INSTALL = yes
23 FRAMEWORK_VERSION = 1.0
24
25 .PHONY: profile-check do-profile-check
26 profile-check:
27         @:
28
29 ifeq (.,$(thisdir))
30 all-recursive: do-profile-check
31 all-local: post-profile-cleanup
32 clean-local: clean-profile
33 endif
34
35 clean-profile:
36         -rm -f $(PROFILE_CS) $(PROFILE_EXE) $(PROFILE_OUT) $(monolite_flag)
37
38 post-profile-cleanup:
39         @rm -f $(monolite_flag)
40
41 PROFILE_CS  = $(topdir)/build/deps/basic-profile-check.cs
42 PROFILE_EXE = $(PROFILE_CS:.cs=.exe)
43 PROFILE_OUT = $(PROFILE_CS:.cs=.out)
44
45 do-profile-check:
46         @ok=:; \
47         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
48         $(MAKE) -s $(PROFILE_OUT) > /dev/null || ok=false; \
49         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
50         if $$ok; then :; else \
51             if test -f $(topdir)/class/lib/monolite/mcs.exe; then \
52                 $(MAKE) -s do-profile-check-monolite ; \
53             else \
54                 echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2; \
55                 echo "*** You need a C# compiler installed to build MCS (make sure mcs works from the command line)" 1>&2 ; \
56                 echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
57                 exit 1; fi; fi
58
59
60 ifdef use_monolite
61
62 do-profile-check-monolite:
63         echo "*** The contents of your 'monolite' directory may be out-of-date" 1>&2
64         echo "*** You may want to try 'make get-monolite-latest'" 1>&2
65         rm -f $(monolite_flag)
66         exit 1
67
68 else
69
70 do-profile-check-monolite:
71         echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2
72         echo "*** Trying the 'monolite' directory." 1>&2
73         echo dummy > $(monolite_flag)
74         $(MAKE) do-profile-check
75
76 endif
77
78 $(PROFILE_CS): $(topdir)/build/profiles/basic.make
79         echo 'class X { static int Main () { return 0; } }' > $@
80
81 $(PROFILE_EXE): $(PROFILE_CS)
82         $(BOOTSTRAP_MCS) /out:$@ $<
83
84 $(PROFILE_OUT): $(PROFILE_EXE)
85         $(PROFILE_RUNTIME) $< > $@ 2>&1