ChangeLog: Updated ChangeLog.
[mono.git] / mcs / build / library.make
1 # -*- makefile -*-
2 #
3 # The rules for building our class libraries.
4 #
5 # The NO_TEST stuff is not too pleasant but whatcha
6 # gonna do.
7
8 # All the dep files now land in the same directory so we
9 # munge in the library name to keep the files from clashing.
10
11 sourcefile = $(LIBRARY).sources
12 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
13 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
14 else
15 response = $(sourcefile)
16 endif
17
18 ifndef LIBRARY_NAME
19 LIBRARY_NAME = $(LIBRARY)
20 endif
21
22 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
23 the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
24 the_pdb = $(patsubst %.dll,%.pdb,$(the_lib))
25
26 ifndef NO_TEST
27 test_nunitfw = $(topdir)/class/lib/$(PROFILE)/nunit.framework.dll 
28 test_nunitcore = $(topdir)/class/lib/$(PROFILE)/nunit.core.dll 
29 test_nunitutil = $(topdir)/class/lib/$(PROFILE)/nunit.util.dll 
30 test_nunit_dep = $(test_nunitfw) $(test_nunitcore) $(test_nunitutil)
31 test_nunit_ref = -r:$(test_nunitfw) -r:$(test_nunitcore) -r:$(test_nunitutil)
32
33 test_lib = $(patsubst %.dll,%_test.dll,$(LIBRARY))
34 test_pdb = $(patsubst %.dll,%.pdb,$(test_lib))
35 test_sourcefile = $(test_lib).sources
36 test_response = $(depsdir)/$(PROFILE)_$(test_lib).response
37 test_makefrag = $(depsdir)/$(PROFILE)_$(test_lib).makefrag
38 test_flags = /r:$(the_lib) $(test_nunit_ref) $(TEST_MCS_FLAGS)
39
40 btest_lib = $(patsubst %.dll,%_btest.dll,$(LIBRARY))
41 btest_pdb = $(patsubst %.dll,%.pdb,$(btest_lib))
42 btest_sourcefile = $(btest_lib).sources
43 btest_response = $(depsdir)/$(btest_lib).response
44 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
45 btest_flags = /r:$(the_lib) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
46
47 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
48 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
49
50 endif
51
52 gacutil = $(topdir)/tools/gacutil/gacutil.exe
53 sn = $(topdir)/tools/security/sn.exe
54
55 PACKAGE = 1.0
56
57 ifeq ($(PROFILE), net_2_0)
58 PACKAGE = 2.0
59 endif
60
61 ifndef NO_SIGN_ASSEMBLY
62 sign = sign_assembly
63 else
64 sign = 
65 endif
66
67 all-local: $(the_lib)
68
69 install-local: $(the_lib) $(gacutil) $(sign)
70         $(RUNTIME)  $(gacutil) /i $(the_lib) /f /root $(DESTDIR)$(prefix)/lib /package $(PACKAGE)
71
72 uninstall-local: $(gacutil)
73         $(RUNTIME) $(gacutil) /u `echo $(LIBRARY_NAME) | sed 's,.dll$,,'`
74
75 $(gacutil):
76         cd $(topdir)/tools/gacutil && $(MAKE)
77
78 $(sn):
79         cd $(topdir)/tools/security && $(MAKE) sn.exe || exit 1 ;
80
81 sign_assembly: $(sn)
82         $(RUNTIME) $(sn) -q -R $(the_lib) $(topdir)/class/mono.snk
83
84 clean-local:
85         -rm -f $(the_lib) $(makefrag) $(test_lib) \
86                $(test_makefrag) $(test_response) \
87                $(the_pdb) $(test_pdb) $(CLEAN_FILES) \
88                TestResult.xml
89 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
90         -rm -rf $(response)
91 endif
92
93
94 test-local: $(the_lib)
95         @:
96 run-test-local:
97         @:
98 run-test-ondotnet-local:
99         @:
100
101 ifndef NO_TEST
102 $(test_nunit_dep): $(topdir)/build/deps/nunit.stamp
103         @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
104 $(topdir)/build/deps/nunit.stamp:
105         cd ${topdir}/nunit20 && $(MAKE)
106         echo "stamp" >$@
107 endif
108
109 ifdef HAVE_CS_TESTS
110
111 test-local: $(test_lib)
112
113 run-test-local: run-test-lib
114
115 run-test-lib: test-local
116         $(TEST_RUNTIME) $(TEST_HARNESS) $(test_lib)
117
118 run-test-ondotnet-local: run-test-ondotnet-lib
119
120 run-test-ondotnet-lib: test-local
121         $(TEST_HARNESS) $(test_lib)
122 endif
123
124 ifdef HAVE_VB_TESTS
125
126 test-local: $(btest_lib)
127
128 run-test-local: run-btest-lib
129
130 run-btest-lib: test-local
131         $(TEST_RUNTIME) $(TEST_HARNESS) $(btest_lib)
132
133 run-test-ondotnet-local: run-btest-ondotnet-lib
134
135 run-btest-ondotnet-lib: test-local
136         $(TEST_HARNESS) $(btest_lib)
137
138 endif
139
140 DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
141
142 TEST_FILES = 
143
144 ifdef HAVE_CS_TESTS
145 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
146 endif
147 ifdef HAVE_VB_TESTS
148 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
149 endif
150
151 dist-local: dist-default
152         for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
153             dest=`dirname $(distdir)/$$f` ; \
154             $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
155         done
156
157 ifndef LIBRARY_COMPILE
158 LIBRARY_COMPILE = $(CSCOMPILE)
159 endif
160
161 # Fun with dependency tracking
162
163 $(the_lib): $(makefrag) $(response)
164         $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
165
166 $(makefrag): $(sourcefile)
167         @echo Creating $@ ...
168         @sed 's,^,$(the_lib): ,' $< >$@
169
170 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
171 $(response): $(sourcefile)
172         @echo Creating $@ ...
173         @$(PLATFORM_CHANGE_SEPARATOR_CMD) $(sourcefile) >$@
174 endif
175
176 -include $(makefrag)
177
178 # for now, don't give any /lib flags or set MONO_PATH, since we
179 # give a full path to the assembly.
180
181 ifdef HAVE_CS_TESTS
182
183 $(test_lib): $(test_makefrag) $(the_lib) $(test_response) $(test_nunit_dep)
184         $(CSCOMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
185
186 $(test_response): $(test_sourcefile)
187         @echo Creating $@ ...
188 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
189         @sed 's,^,Test/,' $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
190 else
191         @sed 's,^,Test/,' $< >$@
192 endif
193
194 $(test_makefrag): $(test_response)
195         @echo Creating $@ ...
196         @sed 's,^,$(test_lib): ,' $< >$@
197
198 -include $(test_makefrag)
199
200 endif
201
202 ifdef HAVE_VB_TESTS
203
204 $(btest_lib): $(btest_makefrag) $(the_lib) $(btest_response) $(test_nunit_dep)
205         $(BASCOMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
206
207 $(btest_response): $(btest_sourcefile)
208         @echo Creating $@ ...
209 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
210         @sed 's,^,Test/,' $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
211 else
212         @sed 's,^,Test/,' $< >$@
213 endif
214
215 $(btest_makefrag): $(btest_response)
216         @echo Creating $@ ...
217         @sed 's,^,$(btest_lib): ,' $< >$@
218
219 -include $(btest_makefrag)
220
221 endif