3 # The rules for building our class libraries.
5 # The NO_TEST stuff is not too pleasant but whatcha
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.
11 sourcefile = $(LIBRARY).sources
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) > $@
24 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
26 ifndef PLATFORM_excludes
27 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
28 response = $(sourcefile)
33 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
34 library_CLEAN_FILES += $(response) $(LIBRARY).mdb $(BUILT_SOURCES)
38 LIBRARY_NAME = $(LIBRARY)
47 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
48 the_lib = $(topdir)/class/$(lib_dir)/$(PROFILE)/$(LIBRARY_NAME)
49 the_pdb = $(the_lib:.dll=.pdb)
50 the_mdb = $(the_lib).mdb
51 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_mdb)
53 ifdef LIBRARY_NEEDS_POSTPROCESSING
54 build_lib = fixup/$(PROFILE)/$(LIBRARY_NAME)
55 library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
57 build_lib = $(the_lib)
61 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
62 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
63 test_nunit_ref = $(test_nunit_dep:%=-r:%)
64 library_CLEAN_FILES += TestResult*.xml
66 test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
67 test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
68 test_pdb = $(test_lib:.dll=.pdb)
69 test_response = $(depsdir)/$(test_lib).response
70 test_makefrag = $(depsdir)/$(test_lib).makefrag
71 test_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MCS_FLAGS)
72 library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
74 btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
75 btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
76 btest_pdb = $(btest_lib:.dll=.pdb)
77 btest_response = $(depsdir)/$(btest_lib).response
78 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
79 btest_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
80 library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
83 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
86 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
94 gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
95 GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
98 ifdef NO_SIGN_ASSEMBLY
101 sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
102 SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
106 ifeq ($(PLATFORM), win32)
107 GACDIR = `cygpath -w $(mono_libdir)`
108 GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
109 test_flags += -d:WINDOWS
111 GACDIR = $(mono_libdir)
112 GACROOT = $(DESTDIR)$(mono_libdir)
115 all-local: $(the_lib)
117 install-local: all-local
118 test-local: all-local
122 install-local uninstall-local:
127 ifdef LIBRARY_INSTALL_DIR
129 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
130 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
131 test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
134 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
138 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
139 # of the runtime is the same as the GACDIR we want. So, we don't need to pass it
140 # to gacutil. Note that the GACDIR we want may not be the same as the value of
141 # GACDIR set above, since the user could have overridden the value of $(prefix).
143 # This makes a difference only when we're building from the mono/ tree, since we
144 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
147 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
148 gacdir_flag = /gacdir $(GACDIR)
151 ifndef LIBRARY_PACKAGE
153 LIBRARY_PACKAGE = compat-$(FRAMEWORK_VERSION)
155 LIBRARY_PACKAGE = $(FRAMEWORK_VERSION)
159 install-local: $(gacutil)
160 $(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) /package $(LIBRARY_PACKAGE)
162 uninstall-local: $(gacutil)
163 -$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) /package $(LIBRARY_PACKAGE)
169 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
171 test-local run-test-local run-test-ondotnet-local:
175 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
176 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
177 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
178 cd ${topdir}/nunit20 && $(MAKE)
180 library_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
186 test_assemblies += $(test_lib)
190 test_assemblies += $(btest_lib)
193 ifdef test_assemblies
194 test-local: $(test_assemblies)
195 run-test-local: run-test-lib
196 run-test-ondotnet-local: run-test-ondotnet-lib
198 TEST_HARNESS_EXCLUDES = /exclude:NotWorking,ValueAdd,CAS,InetAccess
199 TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:NotDotNet,CAS
201 ifdef TEST_HARNESS_VERBOSE
202 TEST_HARNESS_OUTPUT = /labels
203 TEST_HARNESS_OUTPUT_ONDOTNET = /labels
204 TEST_HARNESS_POSTPROC = :
205 TEST_HARNESS_POSTPROC_ONDOTNET = :
207 TEST_HARNESS_OUTPUT = /output:TestResult-$(PROFILE).log
208 TEST_HARNESS_OUTPUT_ONDOTNET = /output:TestResult-ondotnet-$(PROFILE).log
209 TEST_HARNESS_POSTPROC = (echo ''; cat TestResult-$(PROFILE).log) | sed '1,/^Tests run: /d'
210 TEST_HARNESS_POSTPROC_ONDOTNET = (echo ''; cat TestResult-$(PROFILE).log) | sed '1,/^Tests run: /d'
213 ## FIXME: i18n problem in the 'sed' command below
214 run-test-lib: test-local
216 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; \
217 $(TEST_HARNESS_POSTPROC) ; $$ok
219 run-test-ondotnet-lib: test-local
221 $(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; \
222 $(TEST_HARNESS_POSTPROC_ONDOTNET) ; $$ok
225 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
230 TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile)`
231 DISTFILES += $(test_sourcefile)
234 TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile)`
235 DISTFILES += $(btest_sourcefile)
238 dist-local: dist-default
240 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
243 *) dest=`dirname $$f` ; \
244 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
245 cp -p $$f $(distdir)/$$dest || exit 1 ;; \
247 for d in . $$subs ; do \
248 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
250 ifdef LIBRARY_NEEDS_POSTPROCESSING
251 dist-local: dist-fixup
252 FIXUP_PROFILES = default net_2_0
254 $(MKINSTALLDIRS) $(distdir)/fixup $(FIXUP_PROFILES:%=$(distdir)/fixup/%)
257 ifndef LIBRARY_COMPILE
258 LIBRARY_COMPILE = $(CSCOMPILE)
262 TEST_COMPILE = $(CSCOMPILE)
266 BTEST_COMPILE = $(BASCOMPILE)
270 LIBRARY_SNK = $(topdir)/class/mono.snk
275 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
280 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
284 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
285 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
287 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
293 $(build_lib): $(response) $(sn) $(BUILT_SOURCES)
294 ifdef LIBRARY_USE_INTERMEDIATE_FILE
295 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$(LIBRARY_NAME) $(BUILT_SOURCES_cmdline) @$(response)
296 $(SN) $(SNFLAGS) $(LIBRARY_NAME) $(LIBRARY_SNK)
297 mv $(LIBRARY_NAME) $@
298 test ! -f $(LIBRARY_NAME).mdb || mv $(LIBRARY_NAME).mdb $@.mdb
299 test ! -f $(LIBRARY_NAME:.dll=.pdb) || mv $(LIBRARY_NAME:.dll=.pdb) $(dir $@)$(LIBRARY_NAME:.dll=.pdb)
301 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
302 $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
305 $(makefrag): $(sourcefile)
306 @echo Creating $@ ...
307 @sed 's,^,$(build_lib): ,' $< >$@
309 ifneq ($(response),$(sourcefile))
310 $(response): $(sourcefile) $(PLATFORM_excludes)
311 @echo Creating $@ ...
312 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
317 # for now, don't give any /lib flags or set MONO_PATH, since we
318 # give a full path to the assembly.
322 $(test_lib): $(the_lib) $(test_response) $(test_nunit_dep)
323 $(TEST_COMPILE) -target:library -out:$@ $(test_flags) @$(test_response)
325 $(test_response): $(test_sourcefile)
326 @echo Creating $@ ...
327 @sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
329 $(test_makefrag): $(test_response)
330 @echo Creating $@ ...
331 @sed 's,^,$(test_lib): ,' $< >$@
333 -include $(test_makefrag)
339 $(btest_lib): $(the_lib) $(btest_response) $(test_nunit_dep)
340 $(BTEST_COMPILE) -target:library -out:$@ $(btest_flags) @$(btest_response)
342 $(btest_response): $(btest_sourcefile)
343 @echo Creating $@ ...
344 @sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
346 $(btest_makefrag): $(btest_response)
347 @echo Creating $@ ...
348 @sed 's,^,$(btest_lib): ,' $< >$@
350 -include $(btest_makefrag)
354 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
355 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make