imported everything from my branch (which is slightly harmless).
[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)/jay && $(MAKE) ); \
37                 ( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
38                 ( cd $(topdir)/class/lib/monolite/ && cp *.exe *.dll ../basic ); \
39                 case `ls -1t $(topdir)/class/lib/basic/mcs.exe $(topdir)/mcs/cs-parser.cs | sed 1q` in \
40                 $(topdir)/class/lib/basic/mcs.exe) : ;; \
41                 *) sleep 5; cp $(topdir)/class/lib/monolite/mcs.exe $(topdir)/class/lib/basic ;; \
42                 esac; \
43             else \
44                 echo "*** You need a C# compiler installed to build MCS. (make sure mcs works from the command line)" 1>&2 ; \
45                 echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
46                 exit 1; fi; fi
47
48 $(PROFILE_CS): $(topdir)/build/profiles/basic.make
49         echo 'class X { static int Main () { return 0; } }' > $@
50
51 $(PROFILE_EXE): $(PROFILE_CS)
52         $(EXTERNAL_MCS) /out:$@ $<
53
54 $(PROFILE_OUT): $(PROFILE_EXE)
55         $(EXTERNAL_RUNTIME) $< > $@ 2>&1
56