d850774733c61e2a9d79ede8e770ae767047f826
[mono.git] / mcs / build / profiles / basic.make
1 # -*- makefile -*-
2
3 BOOTSTRAP_MCS = $(EXTERNAL_MCS)
4 MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
5
6 PROFILE_MCS_FLAGS = -d:NET_1_1 -d:ONLY_1_1 -d:BOOTSTRAP_WITH_OLDLIB
7 NO_SIGN_ASSEMBLY = yes
8 NO_TEST = yes
9 NO_INSTALL = yes
10
11 .PHONY: profile-check do-profile-check
12 profile-check:
13         @:
14
15 ifeq (.,$(thisdir))
16 all-recursive: do-profile-check
17 clean-local: clean-profile
18 endif
19
20 clean-profile:
21         -rm -f $(PROFILE_CS) $(PROFILE_EXE) $(PROFILE_OUT)
22
23 PROFILE_CS  = $(topdir)/build/deps/basic-profile-check.cs
24 PROFILE_EXE = $(PROFILE_CS:.cs=.exe)
25 PROFILE_OUT = $(PROFILE_CS:.cs=.out)
26
27 do-profile-check:
28         @ok=:; \
29         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
30         $(MAKE) -s $(PROFILE_OUT) || ok=false; \
31         rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
32         if $$ok; then :; else \
33             echo "*** The compiler '$(EXTERNAL_MCS)' doesn't appear to be usable." 1>&2 ; \
34             if test -f $(topdir)/class/lib/monolite/mcs.exe; then \
35                 echo "*** Falling back to using pre-compiled binaries.  Be warned, this may not work." 1>&2 ; \
36                 ( cd $(topdir)/class/lib/monolite/ && cp *.exe *.dll ../basic ); \
37                 ( cd $(topdir)/jay && $(MAKE) ); ( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
38                 touch $(topdir)/class/lib/basic/*; \
39             else \
40                 echo "*** You need a C# compiler installed to build MCS. (make sure mcs works from the command line)" 1>&2 ; \
41                 echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
42                 exit 1; fi; fi
43
44 $(PROFILE_CS): $(topdir)/build/profiles/basic.make
45         echo 'public class X { public static void Main () { System.Console.WriteLine ("OK"); } }' > $@
46
47 $(PROFILE_EXE): $(PROFILE_CS)
48         $(EXTERNAL_MCS) /out:$@ $<
49
50 $(PROFILE_OUT): $(PROFILE_EXE)
51         $(EXTERNAL_RUNTIME) $< > $@ 2>&1
52         set x `wc -l $@`; case $$2 in 1) :;; *) exit 1;; esac
53         grep '^OK$$' $@ > /dev/null