New test.
[mono.git] / mcs / build / profiles / basic.make
index 0305764307482fd310810297baaf9429a804dbd3..690b222894e62c1f0b99f5e4a0f46bb7f6f00090 100644 (file)
@@ -1,12 +1,26 @@
 # -*- 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 := $(topdir)/build/deps/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/mcs.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
+
+MCS = $(with_mono_path) $(INTERNAL_MCS)
 
 PROFILE_MCS_FLAGS = -d:NET_1_1 -d:ONLY_1_1 -d:BOOTSTRAP_WITH_OLDLIB
 NO_SIGN_ASSEMBLY = yes
 NO_TEST = yes
 NO_INSTALL = yes
+FRAMEWORK_VERSION = 1.0
 
 .PHONY: profile-check do-profile-check
 profile-check:
@@ -14,11 +28,15 @@ profile-check:
 
 ifeq (.,$(thisdir))
 all-recursive: do-profile-check
+all-local: post-profile-cleanup
 clean-local: clean-profile
 endif
 
 clean-profile:
-       -rm -f $(PROFILE_CS) $(PROFILE_EXE) $(PROFILE_OUT)
+       -rm -f $(PROFILE_CS) $(PROFILE_EXE) $(PROFILE_OUT) $(monolite_flag)
+
+post-profile-cleanup:
+       @rm -f $(monolite_flag)
 
 PROFILE_CS  = $(topdir)/build/deps/basic-profile-check.cs
 PROFILE_EXE = $(PROFILE_CS:.cs=.exe)
@@ -27,31 +45,41 @@ PROFILE_OUT = $(PROFILE_CS:.cs=.out)
 do-profile-check:
        @ok=:; \
        rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
-       $(MAKE) -s $(PROFILE_OUT) || ok=false; \
+       $(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/monolite/mcs.exe; then \
-               echo "*** Falling back to using pre-compiled binaries.  Be warned, this may not work." 1>&2 ; \
-               ( cd $(topdir)/jay && $(MAKE) ); \
-               ( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
-               ( cd $(topdir)/class/lib/monolite/ && cp *.exe *.dll ../basic ); \
-               case `ls -1t $(topdir)/class/lib/basic/mcs.exe $(topdir)/mcs/cs-parser.cs | sed 1q` in \
-               $(topdir)/class/lib/basic/mcs.exe) : ;; \
-               *) sleep 5; cp $(topdir)/class/lib/monolite/mcs.exe $(topdir)/class/lib/basic ;; \
-               esac; \
+               $(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 installed to build MCS (make sure mcs works from the command line)" 1>&2 ; \
                 echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
                exit 1; fi; fi
 
+
+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:
+       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_CS): $(topdir)/build/profiles/basic.make
-       echo 'public class X { public static void Main () { System.Console.WriteLine ("OK"); } }' > $@
+       echo 'class X { static int Main () { return 0; } }' > $@
 
 $(PROFILE_EXE): $(PROFILE_CS)
-       $(EXTERNAL_MCS) /out:$@ $<
+       $(BOOTSTRAP_MCS) /out:$@ $<
 
 $(PROFILE_OUT): $(PROFILE_EXE)
-       $(EXTERNAL_RUNTIME) $< > $@ 2>&1
-       set x `wc -l $@`; case $$2 in 1) :;; *) exit 1;; esac
-       grep '^OK$$' $@ > /dev/null
+       $(PROFILE_RUNTIME) $< > $@ 2>&1