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:.dll=.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.dll)
51 test_pdb = $(test_lib:.dll=.pdb)
52 test_sourcefile = $(test_lib).sources
53 test_response = $(depsdir)/$(PROFILE)_$(test_lib).response
54 test_makefrag = $(depsdir)/$(PROFILE)_$(test_lib).makefrag
55 test_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
56 library_CLEAN_FILES += $(test_lib) $(test_pdb) $(test_response) $(test_makefrag)
59 btest_lib = $(LIBRARY:.dll=_btest.dll)
61 btest_pdb = $(btest_lib:.dll=.pdb)
62 btest_sourcefile = $(btest_lib).sources
63 btest_response = $(depsdir)/$(btest_lib).response
64 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
65 btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
66 library_CLEAN_FILES += $(btest_lib) $(btest_pdb) $(btest_response) $(btest_makefrag)
69 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
72 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
77 gacutil = $(topdir)/tools/gacutil/gacutil.exe
78 sn = $(topdir)/tools/security/sn.exe
82 ifeq ($(PROFILE), net_2_0)
86 ifeq ($(PLATFORM), win32)
87 GACDIR = `cygpath -w $(DESTDIR)$(prefix)/lib`
89 GACDIR = $(DESTDIR)$(prefix)/lib
92 all-local install-local test-local: $(the_lib)
94 ifdef LIBRARY_INSTALL_DIR
96 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
97 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
98 -$(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
101 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
105 install-local: $(gacutil)
106 MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(GACDIR) /package $(PACKAGE)
108 uninstall-local: $(gacutil)
109 MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(gacutil) /u $(LIBRARY_NAME:.dll=)
113 ifndef NO_SIGN_ASSEMBLY
114 all-local install-local: $(the_lib_signature_stamp)
117 LIBRARY_SNK = $(topdir)/class/mono.snk
120 $(the_lib_signature_stamp): $(the_lib) $(sn)
121 MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(sn) -q -R $(the_lib) $(LIBRARY_SNK)
126 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
128 test-local run-test-local run-test-ondotnet-local:
132 $(test_nunit_dep): $(topdir)/build/deps/nunit.stamp
133 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
134 $(topdir)/build/deps/nunit.stamp:
135 cd ${topdir}/nunit20 && $(MAKE)
141 test-local: $(test_lib)
143 run-test-local: run-test-lib
145 run-test-lib: test-local
146 $(TEST_RUNTIME) $(TEST_HARNESS) $(test_lib)
148 run-test-ondotnet-local: run-test-ondotnet-lib
150 run-test-ondotnet-lib: test-local
151 $(TEST_HARNESS) $(test_lib)
156 test-local: $(btest_lib)
158 run-test-local: run-btest-lib
160 run-btest-lib: test-local
161 $(TEST_RUNTIME) $(TEST_HARNESS) $(btest_lib)
163 run-test-ondotnet-local: run-btest-ondotnet-lib
165 run-btest-ondotnet-lib: test-local
166 $(TEST_HARNESS) $(btest_lib)
170 DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
175 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
178 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
181 dist-local: dist-default
182 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
183 dest=`dirname $(distdir)/$$f` ; \
184 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
187 ifndef LIBRARY_COMPILE
188 LIBRARY_COMPILE = $(CSCOMPILE)
192 TEST_COMPILE = $(CSCOMPILE)
196 BTEST_COMPILE = $(BASCOMPILE)
200 cd $(@D) && $(MAKE) $(@F)
204 $(the_lib): $(response)
205 ifdef LIBRARY_USE_INTERMEDIATE_FILE
206 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(@F) @$(response)
210 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
213 $(makefrag): $(sourcefile)
214 @echo Creating $@ ...
215 @sed 's,^,$(the_lib): ,' $< >$@
217 ifneq ($(response),$(sourcefile))
218 $(response): $(sourcefile) $(PLATFORM_excludes)
219 @echo Creating $@ ...
220 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
225 # for now, don't give any /lib flags or set MONO_PATH, since we
226 # give a full path to the assembly.
230 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
231 $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
233 $(test_response): $(test_sourcefile)
234 @echo Creating $@ ...
235 @sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
237 $(test_makefrag): $(test_response)
238 @echo Creating $@ ...
239 @sed 's,^,$(test_lib): ,' $< >$@
241 -include $(test_makefrag)
247 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
248 $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
250 $(btest_response): $(btest_sourcefile)
251 @echo Creating $@ ...
252 @sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
254 $(btest_makefrag): $(btest_response)
255 @echo Creating $@ ...
256 @sed 's,^,$(btest_lib): ,' $< >$@
258 -include $(btest_makefrag)
262 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
263 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make