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 $(BUILT_SOURCES)
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)
90 libdir = $(prefix)/lib
92 ifeq ($(PLATFORM), win32)
93 GACDIR = `cygpath -w $(libdir)`
94 GACROOT = `cygpath -w $(DESTDIR)$(libdir)`
97 GACROOT = $(DESTDIR)$(libdir)
100 all-local install-local test-local: $(the_lib)
103 install-local uninstall-local:
108 ifdef LIBRARY_INSTALL_DIR
110 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
111 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
112 test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
115 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
119 install-local: $(gacutil)
120 $(GACUTIL) /i $(the_lib) /f /gacdir $(GACDIR) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
122 uninstall-local: $(gacutil)
123 $(GACUTIL) /u $(LIBRARY_NAME:.dll=)
129 -rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
131 test-local run-test-local run-test-ondotnet-local:
135 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
136 @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
137 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
138 cd ${topdir}/nunit20 && $(MAKE)
140 library_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
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) $(TEST_HARNESS_FLAGS) /output:TestResult-$(PROFILE).log /xml:TestResult-$(PROFILE).xml $(test_assemblies)
161 run-test-ondotnet-lib: test-local
162 $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) /output:TestResult-$(PROFILE).log /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 -p $$f $$dest || exit 1 ;; \
183 ifndef LIBRARY_COMPILE
184 LIBRARY_COMPILE = $(CSCOMPILE)
188 TEST_COMPILE = $(CSCOMPILE)
192 BTEST_COMPILE = $(BASCOMPILE)
196 LIBRARY_SNK = $(topdir)/class/mono.snk
200 cd $(topdir)/tools/gacutil && $(MAKE) PROFILE=default
204 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
209 $(the_lib): $(response) $(sn) $(BUILT_SOURCES)
210 ifdef LIBRARY_USE_INTERMEDIATE_FILE
211 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(@F) $(BUILT_SOURCES) @$(response)
212 $(SN) $(SNFLAGS) $(@F) $(LIBRARY_SNK)
214 test ! -f $(@F).mdb || mv $(@F).mdb $@.mdb
216 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ $(BUILT_SOURCES) @$(response)
217 $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
220 $(makefrag): $(sourcefile)
221 @echo Creating $@ ...
222 @sed 's,^,$(the_lib): ,' $< >$@
224 ifneq ($(response),$(sourcefile))
225 $(response): $(sourcefile) $(PLATFORM_excludes)
226 @echo Creating $@ ...
227 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
232 # for now, don't give any /lib flags or set MONO_PATH, since we
233 # give a full path to the assembly.
237 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
238 $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
240 $(test_response): $(test_sourcefile)
241 @echo Creating $@ ...
242 @sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
244 $(test_makefrag): $(test_response)
245 @echo Creating $@ ...
246 @sed 's,^,$(test_lib): ,' $< >$@
248 -include $(test_makefrag)
254 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
255 $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
257 $(btest_response): $(btest_sourcefile)
258 @echo Creating $@ ...
259 @sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
261 $(btest_makefrag): $(btest_response)
262 @echo Creating $@ ...
263 @sed 's,^,$(btest_lib): ,' $< >$@
265 -include $(btest_makefrag)
269 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
270 $(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make