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
12 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
14 ifndef PLATFORM_excludes
15 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
16 response = $(sourcefile)
21 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
22 library_CLEAN_FILES += $(response) $(LIBRARY).mdb $(BUILT_SOURCES)
26 LIBRARY_NAME = $(LIBRARY)
29 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
30 the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
31 the_pdb = $(the_lib:.dll=.pdb)
32 the_mdb = $(the_lib).mdb
33 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_mdb)
36 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
37 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
38 test_nunit_ref = $(test_nunit_dep:%=-r:%)
39 library_CLEAN_FILES += TestResult*.xml
42 test_against = $(the_lib)
47 test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
48 test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
50 test_sourcefile = $(test_lib).sources
52 test_pdb = $(test_lib:.dll=.pdb)
53 test_response = $(depsdir)/$(test_lib).response
54 test_makefrag = $(depsdir)/$(test_lib).makefrag
55 test_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
56 library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
59 btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
60 btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
62 btest_sourcefile = $(btest_lib).sources
64 btest_pdb = $(btest_lib:.dll=.pdb)
65 btest_response = $(depsdir)/$(btest_lib).response
66 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
67 btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
68 library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
71 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
74 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
79 gacutil = $(topdir)/tools/gacutil/gacutil.exe
80 GACUTIL = MONO_PATH="$(topdir)/class/lib/default$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(gacutil)
82 ifdef NO_SIGN_ASSEMBLY
85 sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
86 SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap/$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(sn)
90 libdir = $(prefix)/lib
92 ifeq ($(PLATFORM), win32)
93 GACDIR = `cygpath -w $(libdir)`
94 GACROOT = `cygpath -w $(DESTDIR)$(libdir)`
95 test_flags += -d:WINDOWS
98 GACROOT = $(DESTDIR)$(libdir)
101 all-local install-local test-local: $(the_lib)
104 install-local uninstall-local:
109 ifdef LIBRARY_INSTALL_DIR
111 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
112 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
113 test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
116 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
120 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
121 # of the runtime is the same as the GACDIR we want. So, we don't need to pass it
122 # to gacutil. Note that the GACDIR we want may not be the same as the value of
123 # GACDIR set above, since the user could have overridden the value of $(prefix).
125 # This makes a difference only when we're building from the mono/ tree, since we
126 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
129 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
130 gacdir_flag = /gacdir $(GACDIR)
133 install-local: $(gacutil)
134 $(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
136 uninstall-local: $(gacutil)
137 -$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
143 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
145 test-local run-test-local run-test-ondotnet-local:
149 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
150 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
151 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
152 cd ${topdir}/nunit20 && $(MAKE)
154 library_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
160 test_assemblies += $(test_lib)
164 test_assemblies += $(btest_lib)
167 ifdef test_assemblies
168 test-local: $(test_assemblies)
169 run-test-local: run-test-lib
170 run-test-ondotnet-local: run-test-ondotnet-lib
172 ## FIXME: i18n problem in the 'sed' command below
173 run-test-lib: test-local
175 $(TEST_RUNTIME) $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) /output:TestResult-$(PROFILE).log /exclude:NotWorking,ValueAdd,CAS /xml:TestResult-$(PROFILE).xml $(test_assemblies) || ok=false; \
176 sed '1,/^Tests run: /d' TestResult-$(PROFILE).log; \
179 run-test-ondotnet-lib: test-local
181 $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) /exclude=NotDotNet /output:TestResult-ondotnet-$(PROFILE).log /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies) || ok=false; \
182 sed '1,/^Tests run: /d' TestResult-ondotnet-$(PROFILE).log; \
186 DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
191 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
194 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
197 dist-local: dist-default
198 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
201 *) dest=`dirname $(distdir)/$$f` ; $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ;; \
204 ifndef LIBRARY_COMPILE
205 LIBRARY_COMPILE = $(CSCOMPILE)
209 TEST_COMPILE = $(CSCOMPILE)
213 BTEST_COMPILE = $(BASCOMPILE)
217 LIBRARY_SNK = $(topdir)/class/mono.snk
221 cd $(topdir)/tools/gacutil && $(MAKE) PROFILE=default
225 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
228 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
229 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
231 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
236 $(the_lib): $(response) $(sn) $(BUILT_SOURCES)
237 ifdef LIBRARY_USE_INTERMEDIATE_FILE
238 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(@F) $(BUILT_SOURCES_cmdline) @$(response)
239 $(SN) $(SNFLAGS) $(@F) $(LIBRARY_SNK)
241 test ! -f $(@F).mdb || mv $(@F).mdb $@.mdb
243 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ $(BUILT_SOURCES_cmdline) @$(response)
244 $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
247 $(makefrag): $(sourcefile)
248 @echo Creating $@ ...
249 @sed 's,^,$(the_lib): ,' $< >$@
251 ifneq ($(response),$(sourcefile))
252 $(response): $(sourcefile) $(PLATFORM_excludes)
253 @echo Creating $@ ...
254 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
259 # for now, don't give any /lib flags or set MONO_PATH, since we
260 # give a full path to the assembly.
264 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
265 $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
267 $(test_response): $(test_sourcefile)
268 @echo Creating $@ ...
269 @sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
271 $(test_makefrag): $(test_response)
272 @echo Creating $@ ...
273 @sed 's,^,$(test_lib): ,' $< >$@
275 -include $(test_makefrag)
281 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
282 $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
284 $(btest_response): $(btest_sourcefile)
285 @echo Creating $@ ...
286 @sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
288 $(btest_makefrag): $(btest_response)
289 @echo Creating $@ ...
290 @sed 's,^,$(btest_lib): ,' $< >$@
292 -include $(btest_makefrag)
296 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
297 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make