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 core_sourcefile = $(LIBRARY).sources
12 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
14 ifdef PLATFORM_excludes
15 sourcefile = $(depsdir)/$(LIBRARY).$(PLATFORM)-sources
16 $(sourcefile): $(core_sourcefile) $(PLATFORM_excludes)
17 cat $(core_sourcefile) $(PLATFORM_excludes) | sort | uniq -u >$@
19 sourcefile = $(core_sourcefile)
22 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
23 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
25 response = $(sourcefile)
29 LIBRARY_NAME = $(LIBRARY)
32 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
33 the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
34 the_pdb = $(patsubst %.dll,%.pdb,$(the_lib))
37 test_nunitfw = $(topdir)/class/lib/$(PROFILE)/nunit.framework.dll
38 test_nunitcore = $(topdir)/class/lib/$(PROFILE)/nunit.core.dll
39 test_nunitutil = $(topdir)/class/lib/$(PROFILE)/nunit.util.dll
40 test_nunit_dep = $(test_nunitfw) $(test_nunitcore) $(test_nunitutil)
41 test_nunit_ref = -r:$(test_nunitfw) -r:$(test_nunitcore) -r:$(test_nunitutil)
44 test_against = $(the_lib)
49 test_lib = $(patsubst %.dll,%_test.dll,$(LIBRARY))
51 test_pdb = $(patsubst %.dll,%.pdb,$(test_lib))
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)
58 btest_lib = $(patsubst %.dll,%_btest.dll,$(LIBRARY))
60 btest_pdb = $(patsubst %.dll,%.pdb,$(btest_lib))
61 btest_sourcefile = $(btest_lib).sources
62 btest_response = $(depsdir)/$(btest_lib).response
63 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
64 btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
67 HAVE_CS_TESTS := $(wildcard $(btest_sourcefile))
70 HAVE_VB_TESTS := $(wildcard $(btest_sourcefile))
75 gacutil = $(topdir)/tools/gacutil/gacutil.exe
76 sn = $(topdir)/tools/security/sn.exe
80 ifeq ($(PROFILE), net_2_0)
86 install-local: $(the_lib) maybe-sign-lib
88 ifdef LIBRARY_INSTALL_DIR
90 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
91 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
94 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
98 install-local: $(gacutil)
99 $(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(DESTDIR)$(prefix)/lib /package $(PACKAGE)
101 uninstall-local: $(gacutil)
102 $(RUNTIME) $(gacutil) /u `echo $(LIBRARY_NAME) | sed 's,.dll$,,'`
105 cd $(topdir)/tools/gacutil && $(MAKE)
110 ifndef NO_SIGN_ASSEMBLY
111 maybe-sign-lib: $(sn)
112 $(RUNTIME) $(sn) -q -R $(the_lib) $(topdir)/class/mono.snk
116 cd $(topdir)/tools/security && $(MAKE) sn.exe
119 -rm -f $(the_lib) $(makefrag) $(test_lib) \
120 $(test_makefrag) $(test_response) \
121 $(the_pdb) $(test_pdb) $(CLEAN_FILES) \
123 ifdef PLATFORM_excludes
124 -rm -rf $(sourcefile)
126 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
131 test-local: $(the_lib)
135 run-test-ondotnet-local:
139 $(test_nunit_dep): $(topdir)/build/deps/nunit.stamp
140 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
141 $(topdir)/build/deps/nunit.stamp:
142 cd ${topdir}/nunit20 && $(MAKE)
148 test-local: $(test_lib)
150 run-test-local: run-test-lib
152 run-test-lib: test-local
153 $(TEST_RUNTIME) $(TEST_HARNESS) $(test_lib)
155 run-test-ondotnet-local: run-test-ondotnet-lib
157 run-test-ondotnet-lib: test-local
158 $(TEST_HARNESS) $(test_lib)
163 test-local: $(btest_lib)
165 run-test-local: run-btest-lib
167 run-btest-lib: test-local
168 $(TEST_RUNTIME) $(TEST_HARNESS) $(btest_lib)
170 run-test-ondotnet-local: run-btest-ondotnet-lib
172 run-btest-ondotnet-lib: test-local
173 $(TEST_HARNESS) $(btest_lib)
177 DISTFILES = $(core_sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
182 TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
185 TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
188 dist-local: dist-default
189 for f in `cat $(core_sourcefile)` $(TEST_FILES) ; do \
190 dest=`dirname $(distdir)/$$f` ; \
191 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
194 ifndef LIBRARY_COMPILE
195 LIBRARY_COMPILE = $(CSCOMPILE)
198 # Fun with dependency tracking
200 $(the_lib): $(makefrag) $(response)
201 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
203 $(makefrag): $(sourcefile)
204 @echo Creating $@ ...
205 @sed 's,^,$(the_lib): ,' $< >$@
207 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
208 $(response): $(sourcefile)
209 @echo Creating $@ ...
210 @cat $(sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
215 # for now, don't give any /lib flags or set MONO_PATH, since we
216 # give a full path to the assembly.
220 $(test_lib): $(test_makefrag) $(test_dep) $(test_response) $(test_nunit_dep)
221 $(CSCOMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
223 $(test_response): $(test_sourcefile)
224 @echo Creating $@ ...
225 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
226 @sed 's,^,Test/,' $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
228 @sed 's,^,Test/,' $< >$@
231 $(test_makefrag): $(test_response)
232 @echo Creating $@ ...
233 @sed 's,^,$(test_lib): ,' $< >$@
235 -include $(test_makefrag)
241 $(btest_lib): $(btest_makefrag) $(test_dep) $(btest_response) $(test_nunit_dep)
242 $(BASCOMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
244 $(btest_response): $(btest_sourcefile)
245 @echo Creating $@ ...
246 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
247 @sed 's,^,Test/,' $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
249 @sed 's,^,Test/,' $< >$@
252 $(btest_makefrag): $(btest_response)
253 @echo Creating $@ ...
254 @sed 's,^,$(btest_lib): ,' $< >$@
256 -include $(btest_makefrag)