updating to the latest module.
[mono.git] / mcs / build / profiles / basic.make
1 # -*- makefile -*-
2
3 BOOTSTRAP_MCS = $(EXTERNAL_MCS)
4
5 #
6 # If we are bootstrapping with an external mono -- for example, trying
7 # to do `make basic' with an old mono RPM, we need to make sure that we don't
8 # set MONO_PATH for an old runtime -- otherwise it will get a new corlib and
9 # be fscked up. We do this by testing if the first word of runtime is the same
10 # as external runtime -- if so, we make sure not to set the MONO_PATH on mcs.
11 #
12
13 ifeq ($(word 1, $(RUNTIME)),$(EXTERNAL_RUNTIME))
14 USING_EXT_MONO = yes
15 endif
16
17 ifdef USING_EXT_MONO
18 MCS = $(EXTERNAL_MCS)
19 else
20 MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
21 endif
22
23 PROFILE_MCS_FLAGS = -d:NET_1_1 -d:ONLY_1_1 -d:BOOTSTRAP_WITH_OLDLIB
24 NO_SIGN_ASSEMBLY = yes
25 NO_TEST = yes
26 NO_INSTALL = yes
27
28 .PHONY: profile-check do-profile-check
29 profile-check:
30         @:
31
32 ifeq (.,$(thisdir))
33 all-recursive: do-profile-check
34 clean-local: clean-profile
35 endif
36
37 clean-profile:
38         -rm -f $(PROFILE_CS) $(PROFILE_EXE) $(PROFILE_OUT)
39
40 PROFILE_CS  = $(topdir)/build/deps/basic-profile-check.cs
41 PROFILE_EXE = $(PROFILE_CS:.cs=.exe)
42 PROFILE_OUT = $(PROFILE_CS:.cs=.out)
43
44 do-profile-check:
45         @ok=:; \
46         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
47         $(MAKE) -s $(PROFILE_OUT) || ok=false; \
48         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
49         if $$ok; then :; else \
50             echo "*** The compiler '$(EXTERNAL_MCS)' doesn't appear to be usable." 1>&2 ; \
51             if test -f $(topdir)/class/lib/monolite/mcs.exe; then \
52                 echo "*** Falling back to using pre-compiled binaries.  Be warned, this may not work." 1>&2 ; \
53                 ( cd $(topdir)/jay && $(MAKE) ); \
54                 ( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
55                 ( cd $(topdir)/class/lib/monolite/ && cp *.exe *.dll ../basic ); \
56                 case `ls -1t $(topdir)/class/lib/basic/mcs.exe $(topdir)/mcs/cs-parser.cs | sed 1q` in \
57                 $(topdir)/class/lib/basic/mcs.exe) : ;; \
58                 *) sleep 5; cp $(topdir)/class/lib/monolite/mcs.exe $(topdir)/class/lib/basic ;; \
59                 esac; \
60             else \
61                 echo "*** You need a C# compiler installed to build MCS. (make sure mcs works from the command line)" 1>&2 ; \
62                 echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
63                 exit 1; fi; fi
64
65 $(PROFILE_CS): $(topdir)/build/profiles/basic.make
66         echo 'public class X { public static void Main () { System.Console.WriteLine ("OK"); } }' > $@
67
68 $(PROFILE_EXE): $(PROFILE_CS)
69         $(EXTERNAL_MCS) /out:$@ $<
70
71 $(PROFILE_OUT): $(PROFILE_EXE)
72         $(EXTERNAL_RUNTIME) $< > $@ 2>&1
73         set x `wc -l $@`; case $$2 in 1) :;; *) exit 1;; esac
74         grep '^OK$$' $@ > /dev/null