* Makefile: Use the new FRAMEWORK_VERSION variable to build the destination
[mono.git] / mcs / class / corlib / Makefile
1 thisdir = class/corlib
2 SUBDIRS =
3 include ../../build/rules.make
4 export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
5
6 # corlib is crazy to build so we skip build/library.make and do stuff
7 # ourselves.
8 #
9 # Here, we define a bunch of variables.
10
11 corlib_flags = /unsafe /nostdlib
12 LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 -d:INSIDE_CORLIB
13
14 LIBRARY = corlib.dll
15 LIBRARY_NAME = mscorlib.dll
16 LIB_MCS_FLAGS = $(corlib_flags)
17 LIBRARY_USE_INTERMEDIATE_FILE = yes
18
19 # disable, until people fix their code...
20 #corlib_flags = /unsafe /nostdlib /d:INSIDE_CORLIB
21
22 LIBRARY_INSTALL_DIR = $(prefix)/lib/mono/$(FRAMEWORK_VERSION)
23
24 CLEAN_FILES = $(cmplib) $(reslib) $(plattestlib) $(plattestlib).sources \
25                $(net20bootstrap_makefrag) \
26                $(cmp_response) $(cmp_makefrag) \
27                $(res_response) $(res_makefrag) \
28                $(cmppdb) $(respdb) $(plattestpdb)
29
30 # If building on a non mono-native platform, default
31 # to running the unit tests on its corlib, to see if
32 # our tests are complaint with their (hopefully bug-free)
33 # corlib. If on a mono-native platform, test our actual
34 # corlib.
35 #
36 # You can access either one on demand with either 'make
37 # run-monotest' or 'make run-plattest'.
38
39 plattestlib = corlib_plattest.dll
40 plattestpdb = $(patsubst %.dll,%.pdb,$(plattestlib))
41 reslib = $(topdir)/class/lib/$(PROFILE)/corlib_res.dll
42 cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
43
44 $(plattestlib).sources: corlib_test.dll.sources $(plattestlib).excludes
45         sort corlib_test.dll.sources $(plattestlib).excludes | uniq -u >$@
46
47 TEST_MCS_FLAGS = /debug+ /debug:full /nowarn:0618 /nowarn:0672 /unsafe
48
49 ifndef PLATFORM_MONO_NATIVE
50 test_lib = $(plattestlib)
51 test_against = $(PLATFORM_CORLIB)
52 HAVE_CS_TESTS = $(plattestlib).sources
53
54 ## for now, compiling the testsuite with CSC causes CS0583.  So compile with internal MCS
55 TEST_COMPILE = $(INTERNAL_MCS) $(USE_MCS_FLAGS)
56 endif
57
58 run-test-ondotnet-local: run-plattest-ondotnet
59
60 ifdef PLATFORM_MONO_NATIVE
61 run-monotest: run-test
62 else
63 run-monotest:
64         $(MAKE) $(reslib)
65         $(MAKE) test_lib=corlib_test.dll test_against=$(reslib) run-test
66
67 run-plattest:
68         $(MAKE) test_lib=$(plattestlib) test_against='$(PLATFORM_CORLIB)' run-test
69 endif
70
71 run-plattest-ondotnet: $(plattestlib)
72         $(TEST_HARNESS) $(plattestlib)
73
74 EXTRA_DISTFILES = \
75         corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
76         $(plattestlib).excludes \
77         Test/ms_run_test.sh
78
79 ifeq (net_2_0, $(PROFILE))
80 # Net 2.0 corlib is built with in-tree 'gmcs'
81 LIBRARY_COMPILE = MONO_PATH="../lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(gmcs) $(USE_MCS_FLAGS) /define:NET_1_1 /define:NET_2_0
82 else
83 LIBRARY_COMPILE = $(BOOT_COMPILE)
84 endif
85
86 include ../../build/library.make
87
88 gmcs = $(topdir)/gmcs/gmcs.exe
89 net20bootstraplib = $(topdir)/class/lib/net_2_0_bootstrap/mscorlib.dll
90
91 ifeq (net_2_0, $(PROFILE))
92 $(the_lib): $(gmcs)
93
94 # The in-tree 'gmcs' needs at least a stripped-down version of the net 2.0 corlib.dll.  We build that first.
95 # make sure that $(gmcs) is up-to-date
96 FORCE:
97 $(gmcs): $(net20bootstraplib) FORCE
98         cd $(@D) && $(MAKE) $(@F)
99
100 #net_2_0_bootstrap
101
102 net20bootstrap_makefrag = $(depsdir)/net_2_0_bootstrap_corlib.dll.makefrag
103
104 $(net20bootstraplib): $(net20bootstrap_makefrag) $(response)
105         $(BOOTSTRAP_MCS) $(LOCAL_MCS_FLAGS) /define:NET_1_1 /define:BOOTSTRAP_NET_2_0 $(corlib_flags) /target:library /out:$(net20bootstraplib) @$(response)
106
107 $(net20bootstrap_makefrag): $(response)
108         @echo Creating $@ ...
109         @sed 's,^,$(net20bootstraplib): ,' $< >$@
110
111 -include $(net20bootstrap_makefrag)
112 endif
113
114 # corlib_cmp
115
116 cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
117 cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
118 cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
119 cmp_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
120
121 $(cmplib): $(cmp_makefrag) $(cmp_response)
122         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
123
124 $(cmp_response): $(sourcefile) corlib_cmp.dll.excludes
125         @echo Creating $@ ...
126         @sort $(sourcefile) corlib_cmp.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
127
128 $(cmp_makefrag): $(cmp_response)
129         @echo Creating $@ ...
130         @sed 's,^,$(cmplib): ,' $< >$@
131
132 # Since we make corlib_cmp on demand, there isn't a real need
133 # to have full dep tracking for it. Also, the generation of this
134 # file is busted on Win32 ('sort' seems to mess up line endings),
135 # leading to a broken build.
136 #
137 # -include $(cmp_makefrag)
138
139 # corlib_res
140
141 respdb = $(patsubst %.dll,%.pdb,$(reslib))
142 res_response = $(depsdir)/$(PROFILE)_corlib_res.dll.response
143 res_makefrag = $(depsdir)/$(PROFILE)_corlib_res.dll.makefrag
144 res_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
145
146 $(reslib): $(res_makefrag) $(res_response)
147         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
148
149 $(res_response): $(sourcefile) corlib_res.dll.excludes
150         @echo Creating $@ ...
151         @sort $(sourcefile) corlib_res.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
152
153 # warning: embedded tab in the 'echo touch' line
154 $(res_makefrag): $(res_response)
155         @echo Creating $@ ...
156         @sed 's,^,$(reslib): ,' $< >$@
157
158 -include $(res_makefrag)