Merge pull request #205 from m3rlinez/master
[mono.git] / mcs / mcs / Makefile
1 # To produce a debugging parser, use the version that says "-cvt"
2 JAY_FLAGS=-c
3 # JAY_FLAGS=-cvt
4
5 thisdir := mcs
6 SUBDIRS := 
7 include ../build/rules.make
8
9 EXTRA_DISTFILES = \
10         mcs.csproj              \
11         compiler.doc            \
12         mcs.sln         \
13         cs-parser.jay           \
14         mcs.exe.sources         \
15         NOTES                   \
16         TODO                    \
17         ikvm.cs
18
19 ifeq (basic, $(PROFILE))
20 PROGRAM = basic.exe
21 sourcefile = mcs.exe.sources
22 else
23 PROGRAM_USE_INTERMEDIATE_FILE = true
24 PROGRAM = mcs.exe
25 the_libdir = $(topdir)/class/lib/build/
26 LOCAL_MCS_FLAGS += -lib:$(topdir)/class/lib/build -debug
27 endif
28
29 LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER
30
31 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
32
33 PROGRAM_COMPILE = $(BOOT_COMPILE)
34
35 BUILT_SOURCES = cs-parser.cs
36
37 CLEAN_FILES += y.output
38
39 %-parser.cs: %-parser.jay $(topdir)/jay/skeleton.cs
40         $(topdir)/jay/jay $(JAY_FLAGS) < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
41
42 KEEP_OUTPUT_FILE_COPY = yes
43
44 include ../build/executable.make
45
46 csproj-local:
47         config_file=`basename $(PROGRAM) .exe`-$(PROFILE).input; \
48         echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
49         (echo $(is_boot); \
50         echo $(BOOTSTRAP_MCS);  \
51         echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
52         echo $(PROGRAM); \
53         echo $(BUILT_SOURCES); \
54         echo $(PROGRAM); \
55         echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
56
57 #
58 # Below this line we have local targets used for testing and development
59 #
60
61 # Testing targets
62
63 TIME = time
64
65 # This used to be called test, but that conflicts with the global
66 # recursive target.
67
68 btest: mcs2.exe mcs3.exe
69         ls -l mcs2.exe mcs3.exe
70
71 mcs2.exe: $(PROGRAM)
72         $(TIME) $(RUNTIME) $(RUNTIME_FLAGS) $(PROGRAM) $(USE_MCS_FLAGS) -target:exe -out:$@ $(BUILT_SOURCES) @$(response)
73
74 mcs3.exe: mcs2.exe
75         $(TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs2.exe $(USE_MCS_FLAGS) -target:exe -out:$@ $(BUILT_SOURCES) @$(response)
76
77 wc:
78         wc -l $(BUILT_SOURCES) `cat $(sourcefile)`
79
80 # we need this because bash tries to use its own crappy timer
81 FRIENDLY_TIME = $(shell which time) -f'%U seconds'
82
83 do-time : $(PROGRAM)
84         @ echo -n "Run 1:   "
85         @ rm -f mcs2.exe
86         @ $(MAKE) TIME="$(FRIENDLY_TIME)" mcs2.exe > /dev/null || (echo FAILED; exit 1)
87         @ echo -n "Run 2:   "
88         @ rm -f mcs3.exe
89         @ $(MAKE) TIME="$(FRIENDLY_TIME)" mcs3.exe > /dev/null || (echo FAILED; exit 1)
90         @ $(MAKE) do-corlib
91
92 do-corlib:
93         @ echo -n "corlib:  "
94         @ rm -f ../class/lib/mscorlib.dll
95         @ cd ../class/corlib ; $(MAKE) BOOTSTRAP_MCS='$(FRIENDLY_TIME) mono $$(topdir)/class/lib/$(PROFILE)/mcs.exe' > /dev/null || (echo FAILED; exit 1)
96
97 PROFILER=default
98
99 do-gettext:
100         xgettext --keyword='Report.Error:3' --keyword='Report.Error:2' --keyword='Report.Warning:3' --keyword='Report.Warning:2' -o mcs.po --language='C#' `cat gmcs.exe.sources | grep -v /`
101
102 profile : $(PROGRAM)
103         $(RUNTIME) $(RUNTIME_FLAGS) --profile=$(PROFILER) $(PROGRAM) $(USE_MCS_FLAGS) -target:exe -out:mcs2.exe $(BUILT_SOURCES) @$(response)
104
105 debug-parser:
106         $(MAKE) JAY_FLAGS=-cvt
107
108 #
109 # quick hack target, to quickly develop the gmcs compiler
110 # Update manually.
111
112 q: cs-parser.cs qh
113         echo 'System.Console.WriteLine ("Hello");' | mono csharp.exe
114         echo -e 'using System;\nConsole.WriteLine ("hello");' | mono csharp.exe
115         echo -e '"foo" == "bar";' | mono csharp.exe
116         echo -e 'var a = 1;\na + 2;' | mono csharp.exe
117         echo -e 'int j;\nj = 1;' | mono csharp.exe
118         echo -e 'var a = new int[]{1,2,3};\nfrom x in a select x;' | mono csharp.exe
119         echo -e 'var a = from f in System.IO.Directory.GetFiles ("/tmp") where f == "passwd" select f;' | mono csharp.exe
120
121