Merge pull request #496 from nicolas-raoul/unit-test-for-issue2907
[mono.git] / mcs / mcs / Makefile
index c81badcd7f880addf7862d9122b083fb002abd5f..bc52a7bcdeb6fb23474dee7348813afd7d85f5ed 100644 (file)
@@ -1,88 +1,58 @@
+# To produce a debugging parser, use the version that says "-cvt"
+JAY_FLAGS=-c
+# JAY_FLAGS=-cvt
+
 thisdir := mcs
 SUBDIRS := 
 include ../build/rules.make
 
 EXTRA_DISTFILES = \
-       *mcs.csproj             \
-       compiler.doc            \
-       *mcs.sln                \
-       *cs-parser.jay          \
-       *.sources               \
-       generic.cs              \
-       NOTES                   \
-       TODO                    \
-       gmcs.exe.config
-
-ifeq (1.0, $(FRAMEWORK_VERSION))
-COMPILER_NAME = mcs
+       mcs.csproj              \
+       mcs.sln         \
+       cs-parser.jay           \
+       mcs.exe.sources
+
+ifeq (basic, $(PROFILE))
+PROGRAM = basic.exe
+sourcefile = mcs.exe.sources
+else
+PROGRAM_USE_INTERMEDIATE_FILE = true
+PROGRAM = mcs.exe
+the_libdir = $(topdir)/class/lib/build/
+LOCAL_MCS_FLAGS += -lib:$(topdir)/class/lib/build -debug
 endif
 
-ifeq (2.0, $(FRAMEWORK_VERSION))
-LOCAL_MCS_FLAGS += -d:GMCS_SOURCE
-COMPILER_NAME = gmcs
-endif
+LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
 
-ifeq (2.1, $(FRAMEWORK_VERSION))
-LOCAL_MCS_FLAGS += -d:GMCS_SOURCE -d:SMCS_SOURCE
-COMPILER_NAME = smcs
-endif
+PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
 
-PROGRAM = $(topdir)/class/lib/$(PROFILE)/$(COMPILER_NAME).exe
+PROGRAM_COMPILE = $(BOOT_COMPILE)
 
 BUILT_SOURCES = cs-parser.cs
 
-PROGRAM_COMPILE = $(BOOT_COMPILE)
-
 CLEAN_FILES += y.output
 
 %-parser.cs: %-parser.jay $(topdir)/jay/skeleton.cs
-       $(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
-
-
-ifeq (net_2_0_bootstrap, $(PROFILE))
-
-all-local $(STD_TARGETS:=-local):
-       @:
-
-all-local: $(PROGRAM) $(PROGRAM).config
-clean-local: clean-program
-clean-program:
-       rm -f $(PROGRAM) $(PROGRAM).config
-
-$(PROGRAM) $(PROGRAM).config: $(dir $(PROGRAM))/.stamp
-
-$(PROGRAM): $(topdir)/class/lib/default/mcs.exe
-       cp $< $@
-
-$(PROGRAM).config: gmcs.exe.config
-       cp $< $@
-
-else
-
-ifeq (net_2_0, $(PROFILE))
-
-BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_2_0_bootstrap/gmcs.exe $(DEBUG_FLAGS)
-
-clean-local: clean-net_2_0_bootstrap
-clean-net_2_0_bootstrap:
-       cd .. && $(MAKE) NO_DIR_CHECK=yes PROFILE=net_2_0_bootstrap clean
-
-bootstrap_libs = mscorlib.dll System.dll System.Xml.dll Mono.CompilerServices.SymbolWriter.dll
-bootstrap_libfiles = $(bootstrap_libs:%=$(topdir)/class/lib/net_2_0_bootstrap/%)
-
-$(bootstrap_libfiles): bootstrap-libs
-       @:
-.PHONY: bootstrap-libs
-bootstrap-libs:
-       cd .. && $(MAKE) NO_DIR_CHECK=yes PROFILE=net_2_0_bootstrap all
-
-$(PROGRAM): $(bootstrap_libfiles)
-endif
+       $(topdir)/jay/jay $(JAY_FLAGS) < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
 
 KEEP_OUTPUT_FILE_COPY = yes
 
 include ../build/executable.make
-endif
+
+csproj-local:
+       config_file=`basename $(PROGRAM) .exe`-$(PROFILE).input; \
+       echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
+       (echo $(is_boot); \
+       echo $(BOOTSTRAP_MCS);  \
+       echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
+       echo $(PROGRAM); \
+       echo $(BUILT_SOURCES); \
+       echo $(PROGRAM); \
+       echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
+
+#
+# Below this line we have local targets used for testing and development
+#
 
 # Testing targets
 
@@ -103,10 +73,6 @@ mcs3.exe: mcs2.exe
 wc:
        wc -l $(BUILT_SOURCES) `cat $(sourcefile)`
 
-ctest: 
-       rm -f mcs2.exe mcs3.exe
-       $(MAKE) USE_MCS_FLAGS="-d:NET_1_1 -d:ONLY_1_1" btest
-
 # we need this because bash tries to use its own crappy timer
 FRIENDLY_TIME = $(shell which time) -f'%U seconds'
 
@@ -132,24 +98,21 @@ do-gettext:
 profile : $(PROGRAM)
        $(RUNTIME) $(RUNTIME_FLAGS) --profile=$(PROFILER) $(PROGRAM) $(USE_MCS_FLAGS) -target:exe -out:mcs2.exe $(BUILT_SOURCES) @$(response)
 
+debug-parser:
+       rm cs-parser.cs
+       $(MAKE) JAY_FLAGS=-cvt
+
 #
 # quick hack target, to quickly develop the gmcs compiler
 # Update manually.
-qh:
-       MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) ../class/lib/net_2_0/gmcs.exe  /codepage:65001 -d:GMCS_SOURCE  -d:NET_1_1 -d:NET_2_0 -debug -target:exe -out:gmcs.exe cs-parser.cs  @gmcs.exe.sources
-       @ cp $(COMPILER_NAME).exe* $(topdir)/class/lib/$(PROFILE)/
 
 q: cs-parser.cs qh
-       echo 'System.Console.WriteLine ("Hello");' | csharp
-       echo -e 'using System;\nConsole.WriteLine ("hello");' | csharp
-       echo -e '"foo" == "bar";' | csharp
-       echo -e 'var a = 1;\na + 2;' | csharp
-       echo -e 'int j;\nj = 1;' | csharp
-       echo -e 'var a = new int[]{1,2,3};\nfrom x in a select x;' | csharp
-       echo -e 'var a = from f in System.IO.Directory.GetFiles ("/tmp") where f == "passwd" select f;' | csharp
-
-# read-eval-print-loop test target, for quickly hackign
-repl: 
-       mono --debug gmcs.exe -v --shell
+       echo 'System.Console.WriteLine ("Hello");' | mono csharp.exe
+       echo -e 'using System;\nConsole.WriteLine ("hello");' | mono csharp.exe
+       echo -e '"foo" == "bar";' | mono csharp.exe
+       echo -e 'var a = 1;\na + 2;' | mono csharp.exe
+       echo -e 'int j;\nj = 1;' | mono csharp.exe
+       echo -e 'var a = new int[]{1,2,3};\nfrom x in a select x;' | mono csharp.exe
+       echo -e 'var a = from f in System.IO.Directory.GetFiles ("/tmp") where f == "passwd" select f;' | mono csharp.exe