Add more logging
[mono.git] / mcs / build / profiles / basic.make
index 6a26c59526d9d29150b8abd774282a220519bf79..ca7534fe070a3560a97e727cd5865e820e242f97 100644 (file)
@@ -1,40 +1,91 @@
 # -*- makefile -*-
 
+with_mono_path = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
+with_mono_path_monolite = MONO_PATH="$(topdir)/class/lib/monolite$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
+
+monolite_flag := $(depsdir)/use-monolite
+use_monolite := $(wildcard $(monolite_flag))
+
+ifdef use_monolite
+PROFILE_RUNTIME = $(with_mono_path_monolite) $(RUNTIME)
+BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/monolite/gmcs.exe
+else
+PROFILE_RUNTIME = $(EXTERNAL_RUNTIME)
 BOOTSTRAP_MCS = $(EXTERNAL_MCS)
-MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
+endif
 
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:ONLY_1_1 -d:BOOTSTRAP_WITH_OLDLIB
+MCS = $(with_mono_path) $(INTERNAL_GMCS)
+
+PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:BOOTSTRAP_BASIC
 NO_SIGN_ASSEMBLY = yes
 NO_TEST = yes
 NO_INSTALL = yes
+FRAMEWORK_VERSION = 2.0
+
+# Verbose basic only
+# V = 1
 
+#
+# Copy from rules.make because I don't know how to unset MCS_FLAGS
+#
+USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS)
+
+.PHONY: profile-check do-profile-check
 profile-check:
        @:
 
 ifeq (.,$(thisdir))
-all-recursive: real-profile-check
+all-recursive: do-profile-check
+all-local: post-profile-cleanup
+clean-local: clean-profile
 endif
 
-real-profile-check:
-       -rm -f basic-profile-check.cs basic-profile-check.exe
+clean-profile:
+       -rm -f $(PROFILE_EXE) $(PROFILE_OUT) $(monolite_flag)
+
+post-profile-cleanup:
+       @rm -f $(monolite_flag)
+
+PROFILE_EXE = $(depsdir)/basic-profile-check.exe
+PROFILE_OUT = $(PROFILE_EXE:.exe=.out)
+
+do-profile-check: $(depsdir)/.stamp
        @ok=:; \
-       $$ok && echo 'class X { static void Main () { System.Console.Write("OK");}}' > basic-profile-check.cs; \
-       $$ok && { $(EXTERNAL_MCS) basic-profile-check.cs || ok=false; }; \
-       $$ok && { test -f basic-profile-check.exe || ok=false; }; \
-       $$ok && { $(EXTERNAL_RUNTIME) ./basic-profile-check.exe > /dev/null || ok=false; }; \
-       rm -f basic-profile-check.cs basic-profile-check.exe; \
+       rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
+       $(MAKE) -s $(PROFILE_OUT) > /dev/null || ok=false; \
+       rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
        if $$ok; then :; else \
-           echo "*** The compiler '$(EXTERNAL_MCS)' doesn't appear to be usable." 1>&2 ; \
-           if test -f $(topdir)/class/lib/basic.tar.gz; then \
-               echo "*** Falling back to using pre-compiled binaries.  Be warned, this may not work." 1>&2 ; \
-               ( cd $(topdir)/class/lib; gzip -dc basic.tar.gz | tar xvf - ); \
-               ( cd $(topdir)/jay && $(MAKE) ); ( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
-               touch $(topdir)/class/lib/basic/*; \
+           if test -f $(topdir)/class/lib/monolite/gmcs.exe; then \
+               $(MAKE) -s do-profile-check-monolite ; \
            else \
-                echo "*** You need a C# compiler installed to build MCS. (make sure mcs works from the command line)" 1>&2 ; \
+               echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2; \
+                echo "*** You need a C# compiler version 2.0 or better installed to build MCS" 1>&2 ; \
                 echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
                exit 1; fi; fi
 
-install-local: no-install
-no-install:
+
+ifdef use_monolite
+
+do-profile-check-monolite:
+       echo "*** The contents of your 'monolite' directory may be out-of-date" 1>&2
+       echo "*** You may want to try 'make get-monolite-latest'" 1>&2
+       rm -f $(monolite_flag)
        exit 1
+
+else
+
+do-profile-check-monolite: $(depsdir)/.stamp
+       echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2
+       echo "*** Trying the 'monolite' directory." 1>&2
+       echo dummy > $(monolite_flag)
+       $(MAKE) do-profile-check
+
+endif
+
+$(PROFILE_EXE): $(topdir)/build/common/basic-profile-check.cs
+       $(BOOTSTRAP_MCS) /warn:0 /out:$@ $<
+       echo -n "Bootstrap compiler: " 1>&2
+       $(BOOTSTRAP_MCS) --version 1>&2
+
+$(PROFILE_OUT): $(PROFILE_EXE)
+       $(PROFILE_RUNTIME) $< > $@ 2>&1