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)
41 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
42 the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
43 the_pdb = $(the_lib:.dll=.pdb)
44 the_mdb = $(the_lib).mdb
45 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_mdb)
47 ifdef LIBRARY_NEEDS_POSTPROCESSING
48 build_lib = fixup/$(PROFILE)/$(LIBRARY_NAME)
49 library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
51 build_lib = $(the_lib)
55 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
56 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
57 test_nunit_ref = $(test_nunit_dep:%=-r:%)
58 library_CLEAN_FILES += TestResult*.xml
61 test_against = $(the_lib)
66 test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
67 test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
69 test_sourcefile = $(test_lib).sources
71 test_pdb = $(test_lib:.dll=.pdb)
72 test_response = $(depsdir)/$(test_lib).response
73 test_makefrag = $(depsdir)/$(test_lib).makefrag
74 test_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
75 library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
78 btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
79 btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
81 btest_sourcefile = $(btest_lib).sources
83 btest_pdb = $(btest_lib:.dll=.pdb)
84 btest_response = $(depsdir)/$(btest_lib).response
85 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
86 btest_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
87 library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
90 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
93 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
101 gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
102 GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
105 ifdef NO_SIGN_ASSEMBLY
108 sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
109 SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
113 ifeq ($(PLATFORM), win32)
114 GACDIR = `cygpath -w $(mono_libdir)`
115 GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
116 test_flags += -d:WINDOWS
118 GACDIR = $(mono_libdir)
119 GACROOT = $(DESTDIR)$(mono_libdir)
122 all-local: $(the_lib)
124 install-local: all-local
125 test-local: all-local
129 install-local uninstall-local:
134 ifdef LIBRARY_INSTALL_DIR
136 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
137 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
138 test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
141 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
145 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
146 # of the runtime is the same as the GACDIR we want. So, we don't need to pass it
147 # to gacutil. Note that the GACDIR we want may not be the same as the value of
148 # GACDIR set above, since the user could have overridden the value of $(prefix).
150 # This makes a difference only when we're building from the mono/ tree, since we
151 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
154 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
155 gacdir_flag = /gacdir $(GACDIR)
158 install-local: $(gacutil)
159 $(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
161 uninstall-local: $(gacutil)
162 -$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
168 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
170 test-local run-test-local run-test-ondotnet-local:
174 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
175 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
176 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
177 cd ${topdir}/nunit20 && $(MAKE)
179 library_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
185 test_assemblies += $(test_lib)
189 test_assemblies += $(btest_lib)
192 ifdef test_assemblies
193 test-local: $(test_assemblies)
194 run-test-local: run-test-lib
195 run-test-ondotnet-local: run-test-ondotnet-lib
197 ## FIXME: i18n problem in the 'sed' command below
198 run-test-lib: test-local
200 $(TEST_RUNTIME) $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) /output:TestResult-$(PROFILE).log /exclude:NotWorking,ValueAdd,CAS,InetAccess /xml:TestResult-$(PROFILE).xml $(test_assemblies) || ok=false; \
201 sed '1,/^Tests run: /d' TestResult-$(PROFILE).log; \
204 run-test-ondotnet-lib: test-local
206 $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) /exclude=NotDotNet,CAS /output:TestResult-ondotnet-$(PROFILE).log /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies) || ok=false; \
207 sed '1,/^Tests run: /d' TestResult-ondotnet-$(PROFILE).log; \
211 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
216 TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile)`
217 DISTFILES += $(test_sourcefile)
220 TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile)`
221 DISTFILES += $(btest_sourcefile)
224 dist-local: dist-default
226 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
229 *) dest=`dirname $$f` ; \
230 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
231 cp -p $$f $(distdir)/$$dest || exit 1 ;; \
233 for d in . $$subs ; do \
234 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
236 ifdef LIBRARY_NEEDS_POSTPROCESSING
237 dist-local: dist-fixup
238 FIXUP_PROFILES = default net_2_0
240 $(MKINSTALLDIRS) $(distdir)/fixup $(FIXUP_PROFILES:%=$(distdir)/fixup/%)
243 ifndef LIBRARY_COMPILE
244 LIBRARY_COMPILE = $(CSCOMPILE)
248 TEST_COMPILE = $(CSCOMPILE)
252 BTEST_COMPILE = $(BASCOMPILE)
256 LIBRARY_SNK = $(topdir)/class/mono.snk
261 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
266 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
270 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
271 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
273 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
279 $(build_lib): $(response) $(sn) $(BUILT_SOURCES)
280 ifdef LIBRARY_USE_INTERMEDIATE_FILE
281 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$(LIBRARY_NAME) $(BUILT_SOURCES_cmdline) @$(response)
282 $(SN) $(SNFLAGS) $(LIBRARY_NAME) $(LIBRARY_SNK)
283 mv $(LIBRARY_NAME) $@
284 test ! -f $(LIBRARY_NAME).mdb || mv $(LIBRARY_NAME).mdb $@.mdb
285 test ! -f $(LIBRARY_NAME:.dll=.pdb) || mv $(LIBRARY_NAME:.dll=.pdb) $(dir $@)$(LIBRARY_NAME:.dll=.pdb)
287 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
288 $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
291 $(makefrag): $(sourcefile)
292 @echo Creating $@ ...
293 @sed 's,^,$(build_lib): ,' $< >$@
295 ifneq ($(response),$(sourcefile))
296 $(response): $(sourcefile) $(PLATFORM_excludes)
297 @echo Creating $@ ...
298 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
303 # for now, don't give any /lib flags or set MONO_PATH, since we
304 # give a full path to the assembly.
308 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
309 $(TEST_COMPILE) -target:library -out:$@ $(test_flags) @$(test_response)
311 $(test_response): $(test_sourcefile)
312 @echo Creating $@ ...
313 @sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
315 $(test_makefrag): $(test_response)
316 @echo Creating $@ ...
317 @sed 's,^,$(test_lib): ,' $< >$@
319 -include $(test_makefrag)
325 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
326 $(BTEST_COMPILE) -target:library -out:$@ $(btest_flags) @$(btest_response)
328 $(btest_response): $(btest_sourcefile)
329 @echo Creating $@ ...
330 @sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
332 $(btest_makefrag): $(btest_response)
333 @echo Creating $@ ...
334 @sed 's,^,$(btest_lib): ,' $< >$@
336 -include $(btest_makefrag)
340 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
341 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make