**** Merged r36189 from MCS ****
[mono.git] / mcs / gmcs / Makefile
1 thisdir := gmcs
2 SUBDIRS := 
3 include ../build/rules.make
4
5 COMPILER_SOURCES = \
6         AssemblyInfo.cs                 \
7         anonymous.cs                    \
8         assign.cs                       \
9         attribute.cs                    \
10         driver.cs                       \
11         cs-tokenizer.cs                 \
12         cfold.cs                        \
13         class.cs                        \
14         codegen.cs                      \
15         const.cs                        \
16         constant.cs                     \
17         convert.cs                      \
18         decl.cs                         \
19         delegate.cs                     \
20         enum.cs                         \
21         ecore.cs                        \
22         expression.cs                   \
23         flowanalysis.cs                 \
24         generic.cs                      \
25         iterators.cs                    \
26         literal.cs                      \
27         location.cs                     \
28         modifiers.cs                    \
29         namespace.cs                    \
30         parameter.cs                    \
31         pending.cs                      \
32         report.cs                       \
33         rootcontext.cs                  \
34         statement.cs                    \
35         support.cs                      \
36         typemanager.cs                  \
37         symbolwriter.cs                 \
38         tree.cs                         \
39         CryptoConvert.cs                \
40         $(topdir)/class/Mono.CSharp.Debugger/MonoSymbolFile.cs  \
41         $(topdir)/class/Mono.CSharp.Debugger/MonoSymbolTable.cs \
42         $(topdir)/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
43
44 all_sources = $(COMPILER_SOURCES) cs-parser.cs
45
46 DISTFILES = \
47         $(COMPILER_SOURCES)     \
48         cs-parser.jay           \
49         gmcs.exe.config
50 #       compiler.csproj         \
51 #       compiler.doc            \
52 #       compiler.sln            \
53 #       NOTES                   \
54 #       TODO
55
56 #uncomment to enable some debug stuff
57 #DEBUG_FLAGS=/define:MCS_DEBUG
58
59 all-local: gmcs.exe
60
61 PROGRAM_INSTALL_DIR = $(prefix)/lib/mono/2.0
62
63 install-local: gmcs.exe
64         $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
65         $(INSTALL_BIN) gmcs.exe $(DESTDIR)$(PROGRAM_INSTALL_DIR)
66         $(INSTALL_DATA) gmcs.exe.config $(DESTDIR)$(PROGRAM_INSTALL_DIR)
67         $(INSTALL_DATA) gmcs.exe.mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)
68
69 uninstall-local:
70         -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/gmcs.exe*
71
72 test-local run-test-local:
73
74 clean-local:
75         rm -f *.exe *.pdb cs-parser.cs y.output *.mdb
76         cd .. && $(MAKE) PROFILE=net_2_0_bootstrap clean
77
78 dist-local: dist-default
79
80 bootstrap_libs = mscorlib.dll System.dll System.Xml.dll Mono.CompilerServices.SymbolWriter.dll
81 bootstrap_libfiles = $(bootstrap_libs:%=$(topdir)/class/lib/net_2_0_bootstrap/%)
82
83 $(bootstrap_libfiles): bootstrap-libs
84         @:
85 .PHONY: bootstrap-libs
86 bootstrap-libs:
87         cd .. && $(MAKE) PROFILE=net_2_0_bootstrap all
88
89 gmcs.exe: $(all_sources) $(bootstrap_libfiles)
90         MONO_PATH="../class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" mono ../mcs/mcs.exe $(DEBUG_FLAGS) -2 /target:exe /debug /out:$@ $(all_sources)
91
92 gmcs2.exe: $(all_sources)
93         MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" time mcs -2 /target:exe /debug /out:$@ $^ $(DEBUG_FLAGS) 
94
95 gmcs3.exe: $(all_sources)
96         MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" time $(RUNTIME) ./gmcs2.exe $(USE_MCS_FLAGS) $(DEBUG_FLAGS) -2 /target:exe /debug /out:$@ $^
97
98 gmcs4.exe: $(all_sources)
99         MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" time $(RUNTIME) ./gmcs3.exe $(USE_MCS_FLAGS) $(DEBUG_FLAGS) -2 /target:exe /debug /out:$@ $^
100
101 cs-parser.cs: cs-parser.jay $(topdir)/jay/skeleton.cs
102         $(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
103
104 # Testing targets
105
106 TIME = 
107
108 # This used to be called test, but that conflicts with the global
109 # recursive target.
110
111 btest: gmcs2.exe gmcs3.exe gmcs4.exe
112         ls -l gmcs3.exe gmcs4.exe
113
114 wc:
115         wc -l $(all_sources)
116
117 ctest: 
118         rm -f gmcs3.exe mcs4.exe
119         make btest USE_MCS_FLAGS= 
120
121 # we need this because bash tries to use its own crappy timer
122 FRIENDLY_TIME = $(shell which time) -f'%U seconds'
123
124 do-time : mcs.exe
125         @ echo -n "Run 1:   "
126          $(FRIENDLY_TIME) $(RUNTIME) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
127         @ echo -n "Run 2:   "
128         @ $(FRIENDLY_TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:mcs3.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
129         @ echo -n "corlib:  "
130         @ rm -f ../class/lib/mscorlib.dll
131         @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
132
133 do-corlib:
134         @ echo -n "corlib:  "
135         @ rm -f ../class/lib/mscorlib.dll
136         @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
137
138 PROFILER=default
139
140 profile : gmcs2.exe
141         make gmcs3.exe RUNTIME="$(RUNTIME) --profile"
142
143 response:
144         echo $(all_sources) > res