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