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)
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 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb)
35 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
36 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
37 test_nunit_ref = $(test_nunit_dep:%=-r:%)
38 library_CLEAN_FILES += TestResult.xml
41 test_against = $(the_lib)
46 test_lib = $(LIBRARY:.dll=_test.dll)
48 test_pdb = $(test_lib:.dll=.pdb)
49 test_sourcefile = $(test_lib).sources
50 test_response = $(depsdir)/$(PROFILE)_$(test_lib).response
51 test_makefrag = $(depsdir)/$(PROFILE)_$(test_lib).makefrag
52 test_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
53 library_CLEAN_FILES += $(test_lib) $(test_pdb) $(test_response) $(test_makefrag)
56 btest_lib = $(LIBRARY:.dll=_btest.dll)
58 btest_pdb = $(btest_lib:.dll=.pdb)
59 btest_sourcefile = $(btest_lib).sources
60 btest_response = $(depsdir)/$(btest_lib).response
61 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
62 btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
63 library_CLEAN_FILES += $(btest_lib) $(btest_pdb) $(btest_response) $(btest_makefrag)
66 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
69 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
74 gacutil = $(topdir)/tools/gacutil/gacutil.exe
75 sn = $(topdir)/tools/security/sn.exe
79 ifeq ($(PROFILE), net_2_0)
85 install-local: $(the_lib) maybe-sign-lib
87 ifdef LIBRARY_INSTALL_DIR
89 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
90 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
93 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
97 install-local: $(gacutil)
98 $(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(DESTDIR)$(prefix)/lib /package $(PACKAGE)
100 uninstall-local: $(gacutil)
101 $(RUNTIME) $(gacutil) /u $(LIBRARY_NAME:.dll=)
104 cd $(topdir)/tools/gacutil && $(MAKE)
109 ifndef NO_SIGN_ASSEMBLY
110 maybe-sign-lib: $(sn)
111 $(RUNTIME) $(sn) -q -R $(the_lib) $(topdir)/class/mono.snk
115 cd $(topdir)/tools/security && $(MAKE) sn.exe
118 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
120 test-local: $(the_lib)
124 run-test-ondotnet-local:
128 $(test_nunit_dep): $(topdir)/build/deps/nunit.stamp
129 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
130 $(topdir)/build/deps/nunit.stamp:
131 cd ${topdir}/nunit20 && $(MAKE)
137 test-local: $(test_lib)
139 run-test-local: run-test-lib
141 run-test-lib: test-local
142 $(TEST_RUNTIME) $(TEST_HARNESS) $(test_lib)
144 run-test-ondotnet-local: run-test-ondotnet-lib
146 run-test-ondotnet-lib: test-local
147 $(TEST_HARNESS) $(test_lib)
152 test-local: $(btest_lib)
154 run-test-local: run-btest-lib
156 run-btest-lib: test-local
157 $(TEST_RUNTIME) $(TEST_HARNESS) $(btest_lib)
159 run-test-ondotnet-local: run-btest-ondotnet-lib
161 run-btest-ondotnet-lib: test-local
162 $(TEST_HARNESS) $(btest_lib)
166 DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
171 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
174 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
177 dist-local: dist-default
178 for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
179 dest=`dirname $(distdir)/$$f` ; \
180 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
183 ifndef LIBRARY_COMPILE
184 LIBRARY_COMPILE = $(CSCOMPILE)
188 TEST_COMPILE = $(CSCOMPILE)
192 BTEST_COMPILE = $(BASCOMPILE)
195 # Fun with dependency tracking
197 $(the_lib): $(makefrag) $(response)
198 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
200 $(makefrag): $(sourcefile)
201 @echo Creating $@ ...
202 @sed 's,^,$(the_lib): ,' $< >$@
204 ifneq ($(response),$(sourcefile))
205 $(response): $(sourcefile) $(PLATFORM_excludes)
206 @echo Creating $@ ...
207 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
212 # for now, don't give any /lib flags or set MONO_PATH, since we
213 # give a full path to the assembly.
217 $(test_lib): $(test_makefrag) $(test_dep) $(test_response) $(test_nunit_dep)
218 $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
220 $(test_response): $(test_sourcefile)
221 @echo Creating $@ ...
222 @sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
224 $(test_makefrag): $(test_response)
225 @echo Creating $@ ...
226 @sed 's,^,$(test_lib): ,' $< >$@
228 -include $(test_makefrag)
234 $(btest_lib): $(btest_makefrag) $(test_dep) $(btest_response) $(test_nunit_dep)
235 $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
237 $(btest_response): $(btest_sourcefile)
238 @echo Creating $@ ...
239 @sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
241 $(btest_makefrag): $(btest_response)
242 @echo Creating $@ ...
243 @sed 's,^,$(btest_lib): ,' $< >$@
245 -include $(btest_makefrag)