In .:
[mono.git] / mcs / gmcs / Makefile
1 thisdir := gmcs
2 SUBDIRS := 
3 include ../build/rules.make
4
5 #uncomment to enable some debug stuff
6 #DEBUG_FLAGS=/define:MCS_DEBUG
7
8 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/mcs.exe $(DEBUG_FLAGS)
9
10 BUILT_SOURCES = cs-parser.cs
11
12 EXTRA_DISTFILES = cs-parser.jay
13
14 PROGRAM = $(topdir)/class/lib/$(PROFILE)/gmcs.exe
15 PROGRAM_COMPILE = $(BOOT_COMPILE)
16
17 CLEAN_FILES = y.output *.exe *.mdb
18
19 cs-parser.cs: cs-parser.jay $(topdir)/jay/skeleton.cs
20         $(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
21
22 include ../build/executable.make
23
24 ifeq (net_2_0, $(PROFILE))
25 # Utility rule to make debugging somewhat easier.
26 all-local: gmcs.exe
27 gmcs.exe: $(PROGRAM)
28         cp -p $< $@
29         test ! -f $<.mdb || cp -p $<.mdb $@.mdb
30 endif
31
32 clean-local: clean-net_2_0_bootstrap
33 clean-net_2_0_bootstrap:
34         cd .. && $(MAKE) PROFILE=net_2_0_bootstrap clean
35
36 bootstrap_libs = mscorlib.dll System.dll System.Xml.dll Mono.CompilerServices.SymbolWriter.dll
37 bootstrap_libfiles = $(bootstrap_libs:%=$(topdir)/class/lib/net_2_0_bootstrap/%)
38
39 $(bootstrap_libfiles): bootstrap-libs
40         @:
41 .PHONY: bootstrap-libs
42 bootstrap-libs:
43         cd .. && $(MAKE) PROFILE=net_2_0_bootstrap all
44
45 $(PROGRAM): $(bootstrap_libfiles)
46
47 gmcs2.exe: $(PROGRAM)
48         MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" time $(PROGRAM) -2 /target:exe /debug /out:$@ $^ $(DEBUG_FLAGS) 
49
50 gmcs3.exe: gmcs2.exe
51         MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" time $(RUNTIME) $(RUNTIME_FLAGS) ./gmcs2.exe $(USE_MCS_FLAGS) $(DEBUG_FLAGS) -2 /target:exe /debug /out:$@ $^
52
53 gmcs4.exe: gmcs3.exe
54         MONO_PATH="../class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" time $(RUNTIME) $(RUNTIME_FLAGS) ./gmcs3.exe $(USE_MCS_FLAGS) $(DEBUG_FLAGS) -2 /target:exe /debug /out:$@ $^
55
56
57 # Testing targets
58
59 TIME = 
60
61 # This used to be called test, but that conflicts with the global
62 # recursive target.
63
64 btest: gmcs2.exe gmcs3.exe gmcs4.exe
65         ls -l gmcs3.exe gmcs4.exe
66
67 wc:
68         wc -l $(all_sources)
69
70 ctest: 
71         rm -f gmcs3.exe mcs4.exe
72         make btest USE_MCS_FLAGS= 
73
74 # we need this because bash tries to use its own crappy timer
75 FRIENDLY_TIME = $(shell which time) -f'%U seconds'
76
77 do-time : mcs.exe
78         @ echo -n "Run 1:   "
79          $(FRIENDLY_TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
80         @ echo -n "Run 2:   "
81         @ $(FRIENDLY_TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:mcs3.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
82         @ echo -n "corlib:  "
83         @ rm -f ../class/lib/mscorlib.dll
84         @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
85
86 do-corlib:
87         @ echo -n "corlib:  "
88         @ rm -f ../class/lib/mscorlib.dll
89         @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
90
91 PROFILER=default
92
93 profile : gmcs2.exe
94         -rm -f gmcs3.exe
95         make gmcs3.exe RUNTIME_FLAGS='--profile=$(PROFILER)'
96