(net20bootstrapcorlib): Rename from net20bootstraplib.
[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                $(cmp_response) $(cmp_makefrag) \
26                $(res_response) $(res_makefrag) \
27                $(cmppdb) $(respdb) $(plattestpdb)
28
29 # If building on a non mono-native platform, default
30 # to running the unit tests on its corlib, to see if
31 # our tests are complaint with their (hopefully bug-free)
32 # corlib. If on a mono-native platform, test our actual
33 # corlib.
34 #
35 # You can access either one on demand with either 'make
36 # run-monotest' or 'make run-plattest'.
37
38 plattestlib = corlib_plattest.dll
39 plattestpdb = $(patsubst %.dll,%.pdb,$(plattestlib))
40 reslib = $(topdir)/class/lib/$(PROFILE)/corlib_res.dll
41 cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
42
43 $(plattestlib).sources: corlib_test.dll.sources $(plattestlib).excludes
44         sort corlib_test.dll.sources $(plattestlib).excludes | uniq -u >$@
45
46 TEST_MCS_FLAGS = /debug+ /debug:full /nowarn:0618 /nowarn:0672 /unsafe
47
48 ifndef PLATFORM_MONO_NATIVE
49 test_lib = $(plattestlib)
50 test_against = $(PLATFORM_CORLIB)
51 HAVE_CS_TESTS = $(plattestlib).sources
52
53 ## for now, compiling the testsuite with CSC causes CS0583.  So compile with internal MCS
54 TEST_COMPILE = $(INTERNAL_MCS) $(USE_MCS_FLAGS)
55 endif
56
57 run-test-ondotnet-local: run-plattest-ondotnet
58
59 ifdef PLATFORM_MONO_NATIVE
60 run-monotest: run-test
61 else
62 run-monotest:
63         $(MAKE) $(reslib)
64         $(MAKE) test_lib=corlib_test.dll test_against=$(reslib) run-test
65
66 run-plattest:
67         $(MAKE) test_lib=$(plattestlib) test_against='$(PLATFORM_CORLIB)' run-test
68 endif
69
70 run-plattest-ondotnet: $(plattestlib)
71         $(TEST_HARNESS) /exclude=NotDotNet $(plattestlib)
72
73 EXTRA_DISTFILES = \
74         corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
75         $(plattestlib).excludes \
76         Test/ms_run_test.sh
77
78 ifeq (net_2_0, $(PROFILE))
79 # Net 2.0 corlib is built with in-tree 'gmcs'
80 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
81 else
82 LIBRARY_COMPILE = $(BOOT_COMPILE)
83 endif
84
85 include ../../build/library.make
86
87 gmcs = $(topdir)/gmcs/gmcs.exe
88 net20bootstrapcorlib = $(topdir)/class/lib/net_2_0_bootstrap/mscorlib.dll
89 net20bootstrapSystem = $(topdir)/class/lib/net_2_0_bootstrap/System.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): $(net20bootstrapcorlib) $(net20bootstrapSystem) FORCE
98         cd $(@D) && $(MAKE) $(@F)
99
100 #net_2_0_bootstrap
101
102 $(net20bootstrapcorlib): FORCE
103         $(MAKE) PROFILE=net_2_0_bootstrap
104
105 $(net20bootstrapSystem): FORCE
106         cd $(topdir)/class/System && $(MAKE) PROFILE=net_2_0_bootstrap
107
108 clean-local: clean-net20bootstrap
109 clean-net20bootstrap:
110         $(MAKE) PROFILE=net_2_0_bootstrap clean
111         cd $(topdir)/class/System && $(MAKE) PROFILE=net_2_0_bootstrap clean
112         cd $(topdir)/gmcs && $(MAKE) clean
113
114 endif
115
116 # corlib_cmp
117
118 cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
119 cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
120 cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
121 cmp_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
122
123 $(cmplib): $(cmp_makefrag) $(cmp_response)
124         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
125
126 $(cmp_response): $(sourcefile) corlib_cmp.dll.excludes
127         @echo Creating $@ ...
128         @sort $(sourcefile) corlib_cmp.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
129
130 $(cmp_makefrag): $(cmp_response)
131         @echo Creating $@ ...
132         @sed 's,^,$(cmplib): ,' $< >$@
133
134 # Since we make corlib_cmp on demand, there isn't a real need
135 # to have full dep tracking for it. Also, the generation of this
136 # file is busted on Win32 ('sort' seems to mess up line endings),
137 # leading to a broken build.
138 #
139 # -include $(cmp_makefrag)
140
141 # corlib_res
142
143 respdb = $(patsubst %.dll,%.pdb,$(reslib))
144 res_response = $(depsdir)/$(PROFILE)_corlib_res.dll.response
145 res_makefrag = $(depsdir)/$(PROFILE)_corlib_res.dll.makefrag
146 res_flags = /r:$(PLATFORM_CORLIB) $(corlib_flags)
147
148 $(reslib): $(res_makefrag) $(res_response)
149         $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) /target:library /out:$@ @$(res_response)
150
151 $(res_response): $(sourcefile) corlib_res.dll.excludes
152         @echo Creating $@ ...
153         @sort $(sourcefile) corlib_res.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
154
155 # warning: embedded tab in the 'echo touch' line
156 $(res_makefrag): $(res_response)
157         @echo Creating $@ ...
158         @sed 's,^,$(reslib): ,' $< >$@
159
160 -include $(res_makefrag)