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