* PropertyGridTextBox.cs: Add a method that sends any forwarded
[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
13 # If the directory contains the per profile include file, generate list file.
14 PROFILE_sources = $(PROFILE)_$(LIBRARY).sources
15 ifeq ($(wildcard $(PROFILE_sources)), $(PROFILE_sources))
16 PROFILE_excludes = $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)
17 COMMON_sourcefile := $(sourcefile)
18 sourcefile = $(depsdir)/$(PROFILE)_$(LIBRARY).sources
19 $(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(COMMON_sourcefile)
20         @echo Creating the per profile list $@ ...
21         $(topdir)/tools/gensources.sh $(PROFILE_sources) $(PROFILE_excludes) > $@
22 endif
23
24 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
25
26 ifndef PLATFORM_excludes
27 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
28 response = $(sourcefile)
29 endif
30 endif
31
32 ifndef response
33 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
34 library_CLEAN_FILES += $(response) $(LIBRARY).mdb $(BUILT_SOURCES)
35 endif
36
37 ifndef LIBRARY_NAME
38 LIBRARY_NAME = $(LIBRARY)
39 endif
40
41 ifdef LIBRARY_COMPAT
42 lib_dir = compat
43 else
44 lib_dir = lib
45 endif
46
47 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
48 the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/
49 the_lib = $(the_libdir)$(LIBRARY_NAME)
50 the_pdb = $(the_lib:.dll=.pdb)
51 the_mdb = $(the_lib).mdb
52 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_mdb)
53
54 ifdef LIBRARY_NEEDS_POSTPROCESSING
55 build_libdir = fixup/$(PROFILE)/
56 build_lib = $(build_libdir)$(LIBRARY_NAME)
57 library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
58 else
59 build_lib = $(the_lib)
60 endif
61
62 ifndef NO_TEST
63 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
64 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
65 test_nunit_ref = $(test_nunit_dep:%=-r:%)
66 library_CLEAN_FILES += TestResult*.xml
67
68 test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
69 test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
70 test_pdb = $(test_lib:.dll=.pdb)
71 test_response = $(depsdir)/$(test_lib).response
72 test_makefrag = $(depsdir)/$(test_lib).makefrag
73 test_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MCS_FLAGS)
74 library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
75
76 btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
77 btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
78 btest_pdb = $(btest_lib:.dll=.pdb)
79 btest_response = $(depsdir)/$(btest_lib).response
80 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
81 btest_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
82 library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
83
84 ifndef HAVE_CS_TESTS
85 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
86 endif
87 ifndef HAVE_VB_TESTS
88 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
89 endif
90
91 endif
92
93 ifdef NO_INSTALL
94 GACUTIL = :
95 else
96 gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
97 GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
98 endif
99
100 ifdef NO_SIGN_ASSEMBLY
101 SN = :
102 else
103 sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
104 SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
105 SNFLAGS = -q -R
106 endif
107
108 ifeq ($(PLATFORM), win32)
109 GACDIR = `cygpath -w $(mono_libdir)`
110 GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
111 test_flags += -d:WINDOWS
112 else
113 GACDIR = $(mono_libdir)
114 GACROOT = $(DESTDIR)$(mono_libdir)
115 endif
116
117 all-local: $(the_lib)
118
119 install-local: all-local
120 test-local: all-local
121 uninstall-local:
122
123 ifdef NO_INSTALL
124 install-local uninstall-local:
125         @:
126
127 else
128
129 ifdef LIBRARY_INSTALL_DIR
130 install-local:
131         $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
132         $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
133         test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
134
135 uninstall-local:
136         -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
137
138 else
139
140 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
141 # of the runtime is the same as the GACDIR we want.  So, we don't need to pass it
142 # to gacutil.  Note that the GACDIR we want may not be the same as the value of
143 # GACDIR set above, since the user could have overridden the value of $(prefix).
144 #
145 # This makes a difference only when we're building from the mono/ tree, since we
146 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
147 # install the DLLs.
148
149 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
150 gacdir_flag = /gacdir $(GACDIR)
151 endif
152
153 ifndef LIBRARY_PACKAGE
154 ifdef LIBRARY_COMPAT
155 LIBRARY_PACKAGE = compat-$(FRAMEWORK_VERSION)
156 else
157 LIBRARY_PACKAGE = $(FRAMEWORK_VERSION)
158 endif
159 endif
160
161 install-local: $(gacutil)
162         $(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) /package $(LIBRARY_PACKAGE)
163
164 uninstall-local: $(gacutil)
165         -$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) /package $(LIBRARY_PACKAGE)
166
167 endif
168 endif
169
170 clean-local:
171         -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
172
173 test-local run-test-local run-test-ondotnet-local:
174         @:
175
176 ifndef NO_TEST
177 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
178         @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
179 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
180         cd ${topdir}/nunit20 && $(MAKE)
181         echo "stamp" >$@
182 library_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
183 endif
184
185 test_assemblies :=
186
187 ifdef HAVE_CS_TESTS
188 test_assemblies += $(test_lib)
189 endif
190
191 ifdef HAVE_VB_TESTS
192 test_assemblies += $(btest_lib)
193 endif
194
195 ifdef test_assemblies
196 test-local: $(test_assemblies)
197 run-test-local: run-test-lib
198 run-test-ondotnet-local: run-test-ondotnet-lib
199
200 TEST_HARNESS_EXCLUDES = /exclude:NotWorking,ValueAdd,CAS,InetAccess
201 TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:NotDotNet,CAS
202
203 ifdef TEST_HARNESS_VERBOSE
204 TEST_HARNESS_OUTPUT = /labels
205 TEST_HARNESS_OUTPUT_ONDOTNET = /labels
206 TEST_HARNESS_POSTPROC = :
207 TEST_HARNESS_POSTPROC_ONDOTNET = :
208 else
209 TEST_HARNESS_OUTPUT = /output:TestResult-$(PROFILE).log
210 TEST_HARNESS_OUTPUT_ONDOTNET = /output:TestResult-ondotnet-$(PROFILE).log
211 TEST_HARNESS_POSTPROC = (echo ''; cat TestResult-$(PROFILE).log) | sed '1,/^Tests run: /d'
212 TEST_HARNESS_POSTPROC_ONDOTNET = (echo ''; cat TestResult-ondotnet-$(PROFILE).log) | sed '1,/^Tests run: /d'
213 endif
214
215 ## FIXME: i18n problem in the 'sed' command below
216 run-test-lib: test-local
217         ok=:; \
218         MONO_REGISTRY_PATH="$(HOME)/.mono/registry" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) /xml:TestResult-$(PROFILE).xml $(test_assemblies) || ok=false; \
219         $(TEST_HARNESS_POSTPROC) ; $$ok
220
221 run-test-ondotnet-lib: test-local
222         ok=:; \
223         $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) $(TEST_HARNESS_EXCLUDES_ONDOTNET) $(TEST_HARNESS_OUTPUT_ONDOTNET) /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies) || ok=false; \
224         $(TEST_HARNESS_POSTPROC_ONDOTNET) ; $$ok
225 endif
226
227 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
228
229 TEST_FILES =
230
231 ifdef HAVE_CS_TESTS
232 TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile)`
233 DISTFILES += $(test_sourcefile)
234 endif
235 ifdef HAVE_VB_TESTS
236 TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile)`
237 DISTFILES += $(btest_sourcefile)
238 endif
239
240 dist-local: dist-default
241         subs=' ' ; \
242         for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
243           case $$f in \
244           ../*) : ;; \
245           *) dest=`dirname $$f` ; \
246              case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
247              cp -p $$f $(distdir)/$$dest || exit 1 ;; \
248           esac ; done ; \
249         for d in . $$subs ; do \
250           case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
251
252 ifdef LIBRARY_NEEDS_POSTPROCESSING
253 dist-local: dist-fixup
254 FIXUP_PROFILES = default net_2_0
255 dist-fixup:
256         $(MKINSTALLDIRS) $(distdir)/fixup $(FIXUP_PROFILES:%=$(distdir)/fixup/%)
257 endif
258
259 ifndef LIBRARY_COMPILE
260 LIBRARY_COMPILE = $(CSCOMPILE)
261 endif
262
263 ifndef TEST_COMPILE
264 TEST_COMPILE = $(CSCOMPILE)
265 endif
266
267 ifndef BTEST_COMPILE
268 BTEST_COMPILE = $(BASCOMPILE)
269 endif
270
271 ifndef LIBRARY_SNK
272 LIBRARY_SNK = $(topdir)/class/mono.snk
273 endif
274
275 ifdef gacutil
276 $(gacutil):
277         cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
278 endif
279
280 ifdef sn
281 $(sn):
282         cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
283 endif
284
285 ifdef BUILT_SOURCES
286 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
287 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
288 else
289 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
290 endif
291 endif
292
293 # The library
294
295 $(the_libdir)/.stamp $(build_libdir:=/.stamp):
296         $(MKINSTALLDIRS) $(@D)
297         touch $@
298
299 $(the_lib): $(the_libdir)/.stamp
300
301 $(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir:=/.stamp)
302 ifdef LIBRARY_USE_INTERMEDIATE_FILE
303         $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$(LIBRARY_NAME) $(BUILT_SOURCES_cmdline) @$(response)
304         $(SN) $(SNFLAGS) $(LIBRARY_NAME) $(LIBRARY_SNK)
305         mv $(LIBRARY_NAME) $@
306         test ! -f $(LIBRARY_NAME).mdb || mv $(LIBRARY_NAME).mdb $@.mdb
307         test ! -f $(LIBRARY_NAME:.dll=.pdb) || mv $(LIBRARY_NAME:.dll=.pdb) $(dir $@)$(LIBRARY_NAME:.dll=.pdb)
308 else
309         $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
310         $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
311 endif
312
313 $(makefrag): $(sourcefile)
314         @echo Creating $@ ...
315         @sed 's,^,$(build_lib): ,' $< >$@
316
317 ifneq ($(response),$(sourcefile))
318 $(response): $(sourcefile) $(PLATFORM_excludes)
319         @echo Creating $@ ...
320         @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
321 endif
322
323 -include $(makefrag)
324
325 # for now, don't give any /lib flags or set MONO_PATH, since we
326 # give a full path to the assembly.
327
328 ifdef HAVE_CS_TESTS
329
330 $(test_lib): $(the_lib) $(test_response) $(test_nunit_dep)
331         $(TEST_COMPILE) -target:library -out:$@ $(test_flags) @$(test_response)
332
333 $(test_response): $(test_sourcefile)
334         @echo Creating $@ ...
335         @sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
336
337 $(test_makefrag): $(test_response)
338         @echo Creating $@ ...
339         @sed 's,^,$(test_lib): ,' $< >$@
340
341 -include $(test_makefrag)
342
343 endif
344
345 ifdef HAVE_VB_TESTS
346
347 $(btest_lib): $(the_lib) $(btest_response) $(test_nunit_dep)
348         $(BTEST_COMPILE) -target:library -out:$@ $(btest_flags) @$(btest_response)
349
350 $(btest_response): $(btest_sourcefile)
351         @echo Creating $@ ...
352         @sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
353
354 $(btest_makefrag): $(btest_response)
355         @echo Creating $@ ...
356         @sed 's,^,$(btest_lib): ,' $< >$@
357
358 -include $(btest_makefrag)
359
360 endif
361
362 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
363 ifneq ($(response),$(sourcefile))
364 $(response): $(topdir)/build/library.make $(depsdir)/.stamp
365 endif
366 $(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp