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
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:$$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:$$MONO_PATH" $(RUNTIME) $(sn)
92 ifeq ($(PROFILE), net_2_0)
96 ifeq ($(PLATFORM), win32)
97 GACDIR = `cygpath -w $(DESTDIR)$(prefix)/lib`
99 GACDIR = $(DESTDIR)$(prefix)/lib
102 all-local install-local test-local: $(the_lib)
104 ifdef LIBRARY_INSTALL_DIR
106 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
107 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
108 -$(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
111 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
115 install-local: $(gacutil)
116 $(GACUTIL) /i $(the_lib) /f /root $(GACDIR) /package $(PACKAGE)
118 uninstall-local: $(gacutil)
119 $(GACUTIL) /u $(LIBRARY_NAME:.dll=)
125 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
127 test-local run-test-local run-test-ondotnet-local:
131 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
132 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
133 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
134 cd ${topdir}/nunit20 && $(MAKE)
136 library_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
142 test_assemblies += $(test_lib)
146 test_assemblies += $(btest_lib)
149 ifdef test_assemblies
150 test-local: $(test_assemblies)
151 run-test-local: run-test-lib
152 run-test-ondotnet-local: run-test-ondotnet-lib
154 run-test-lib: test-local
155 $(TEST_RUNTIME) $(TEST_HARNESS) /xml:TestResult-$(PROFILE).xml $(test_assemblies)
157 run-test-ondotnet-lib: test-local
158 $(TEST_HARNESS) /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies)
161 DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
166 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
169 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
172 dist-local: dist-default
173 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
176 *) dest=`dirname $(distdir)/$$f` ; $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ;; \
179 ifndef LIBRARY_COMPILE
180 LIBRARY_COMPILE = $(CSCOMPILE)
184 TEST_COMPILE = $(CSCOMPILE)
188 BTEST_COMPILE = $(BASCOMPILE)
192 LIBRARY_SNK = $(topdir)/class/mono.snk
196 cd $(topdir)/gacutil && $(MAKE) PROFILE=default
200 cd $(topdir)/tools/security && $(MAKE) PROFILE=net_1_1_bootstrap
205 $(the_lib): $(response) $(sn)
206 ifdef LIBRARY_USE_INTERMEDIATE_FILE
207 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(@F) @$(response)
208 $(SN) $(SNFLAGS) $(@F) $(LIBRARY_SNK)
212 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
213 $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
216 $(makefrag): $(sourcefile)
217 @echo Creating $@ ...
218 @sed 's,^,$(the_lib): ,' $< >$@
220 ifneq ($(response),$(sourcefile))
221 $(response): $(sourcefile) $(PLATFORM_excludes)
222 @echo Creating $@ ...
223 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
228 # for now, don't give any /lib flags or set MONO_PATH, since we
229 # give a full path to the assembly.
233 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
234 $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
236 $(test_response): $(test_sourcefile)
237 @echo Creating $@ ...
238 @sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
240 $(test_makefrag): $(test_response)
241 @echo Creating $@ ...
242 @sed 's,^,$(test_lib): ,' $< >$@
244 -include $(test_makefrag)
250 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
251 $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
253 $(btest_response): $(btest_sourcefile)
254 @echo Creating $@ ...
255 @sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
257 $(btest_makefrag): $(btest_response)
258 @echo Creating $@ ...
259 @sed 's,^,$(btest_lib): ,' $< >$@
261 -include $(btest_makefrag)
265 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
266 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make