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_lib_signature_stamp = $(makefrag:.makefrag=.was_signed)
32 the_pdb = $(the_lib:.dll=.pdb)
33 the_mdb = $(the_lib).mdb
34 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) \
35 $(the_mdb) $(the_lib_signature_stamp)
38 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
39 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
40 test_nunit_ref = $(test_nunit_dep:%=-r:%)
41 library_CLEAN_FILES += TestResult*.xml
44 test_against = $(the_lib)
49 test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
50 test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
52 test_sourcefile = $(test_lib).sources
54 test_pdb = $(test_lib:.dll=.pdb)
55 test_response = $(depsdir)/$(test_lib).response
56 test_makefrag = $(depsdir)/$(test_lib).makefrag
57 test_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
58 library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
61 btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
62 btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
64 btest_sourcefile = $(btest_lib).sources
66 btest_pdb = $(btest_lib:.dll=.pdb)
67 btest_response = $(depsdir)/$(btest_lib).response
68 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
69 btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
70 library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
73 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
76 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
81 gacutil = $(topdir)/tools/gacutil/gacutil.exe
82 sn = $(topdir)/tools/security/sn.exe
86 ifeq ($(PROFILE), net_2_0)
90 ifeq ($(PLATFORM), win32)
91 GACDIR = `cygpath -w $(DESTDIR)$(prefix)/lib`
93 GACDIR = $(DESTDIR)$(prefix)/lib
96 all-local install-local test-local: $(the_lib)
98 ifdef LIBRARY_INSTALL_DIR
100 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
101 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
102 -$(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
105 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
109 install-local: $(gacutil)
110 MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(GACDIR) /package $(PACKAGE)
112 uninstall-local: $(gacutil)
113 MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(gacutil) /u $(LIBRARY_NAME:.dll=)
117 ifndef NO_SIGN_ASSEMBLY
118 all-local install-local: $(the_lib_signature_stamp)
121 LIBRARY_SNK = $(topdir)/class/mono.snk
124 $(the_lib_signature_stamp): $(the_lib) $(sn)
125 MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(sn) -q -R $(the_lib) $(LIBRARY_SNK)
130 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
132 test-local run-test-local run-test-ondotnet-local:
136 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
137 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
138 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
139 cd ${topdir}/nunit20 && $(MAKE)
146 test_assemblies += $(test_lib)
150 test_assemblies += $(btest_lib)
153 ifdef test_assemblies
154 test-local: $(test_assemblies)
155 run-test-local: run-test-lib
156 run-test-ondotnet-local: run-test-ondotnet-lib
158 run-test-lib: test-local
159 $(TEST_RUNTIME) $(TEST_HARNESS) /xml:TestResult-$(PROFILE).xml $(test_assemblies)
161 run-test-ondotnet-lib: test-local
162 $(TEST_HARNESS) /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies)
165 DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
170 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
173 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
176 dist-local: dist-default
177 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
180 *) dest=`dirname $(distdir)/$$f` ; $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ;; \
183 ifndef LIBRARY_COMPILE
184 LIBRARY_COMPILE = $(CSCOMPILE)
188 TEST_COMPILE = $(CSCOMPILE)
192 BTEST_COMPILE = $(BASCOMPILE)
196 cd $(@D) && $(MAKE) $(@F)
200 $(the_lib): $(response)
201 ifdef LIBRARY_USE_INTERMEDIATE_FILE
202 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(@F) @$(response)
206 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
209 $(makefrag): $(sourcefile)
210 @echo Creating $@ ...
211 @sed 's,^,$(the_lib): ,' $< >$@
213 ifneq ($(response),$(sourcefile))
214 $(response): $(sourcefile) $(PLATFORM_excludes)
215 @echo Creating $@ ...
216 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
221 # for now, don't give any /lib flags or set MONO_PATH, since we
222 # give a full path to the assembly.
226 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
227 $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
229 $(test_response): $(test_sourcefile)
230 @echo Creating $@ ...
231 @sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
233 $(test_makefrag): $(test_response)
234 @echo Creating $@ ...
235 @sed 's,^,$(test_lib): ,' $< >$@
237 -include $(test_makefrag)
243 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
244 $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
246 $(btest_response): $(btest_sourcefile)
247 @echo Creating $@ ...
248 @sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
250 $(btest_makefrag): $(btest_response)
251 @echo Creating $@ ...
252 @sed 's,^,$(btest_lib): ,' $< >$@
254 -include $(btest_makefrag)
258 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
259 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make