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
13 # If the directory contains the per profile include file, generate list file.
14 PROFILE_sources = $(PROFILE)_$(LIBRARY).sources
15 ifeq ($(wildcard $(PROFILE_sources)), $(PROFILE_sources))
16 PROFILE_excludes = $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)
17 COMMON_sourcefile := $(sourcefile)
18 sourcefile = $(depsdir)/$(PROFILE)_$(LIBRARY).sources
19 $(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(COMMON_sourcefile)
20 @echo Creating the per profile list $@ ...
21 $(topdir)/tools/gensources.sh $(PROFILE_sources) $(PROFILE_excludes) > $@
24 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
26 ifndef PLATFORM_excludes
27 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
28 response = $(sourcefile)
33 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
34 library_CLEAN_FILES += $(response) $(LIBRARY).mdb $(BUILT_SOURCES)
38 LIBRARY_NAME = $(LIBRARY)
47 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
48 the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/
49 the_lib = $(the_libdir)$(LIBRARY_NAME)
50 the_pdb = $(the_lib:.dll=.pdb)
51 the_mdb = $(the_lib).mdb
52 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_lib).so $(the_pdb) $(the_mdb)
54 ifdef LIBRARY_NEEDS_POSTPROCESSING
55 build_libdir = fixup/$(PROFILE)/
57 ifdef LIBRARY_USE_INTERMEDIATE_FILE
58 build_libdir = $(the_libdir)tmp/
60 build_libdir = $(the_libdir)
64 build_lib = $(build_libdir)$(LIBRARY_NAME)
65 library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
67 ifdef NO_SIGN_ASSEMBLY
70 sn = $(topdir)/class/lib/basic/sn.exe
71 SN = $(Q) MONO_PATH="$(topdir)/class/lib/basic$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
75 ifeq ($(PLATFORM), win32)
76 GACDIR = `cygpath -w $(mono_libdir)`
77 GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
78 test_flags += -d:WINDOWS
80 GACDIR = $(mono_libdir)
81 GACROOT = $(DESTDIR)$(mono_libdir)
85 all-local: $(the_lib) $(extra_targets)
88 ifeq ($(LIBRARY_COMPILE),$(BOOT_COMPILE))
95 config_file=`basename $(LIBRARY) .dll`-$(PROFILE).input; \
96 echo $(thisdir):$$config_file >> $(topdir)/../mono/msvc/scripts/order; \
99 echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
100 echo $(LIBRARY_NAME); \
101 echo $(BUILT_SOURCES_cmdline); \
103 echo $(response)) > $(topdir)/../mono/msvc/scripts/inputs/$$config_file
106 install-local: all-local
107 test-local: all-local
111 install-local uninstall-local:
116 aot_lib = $(the_lib)$(PLATFORM_AOT_SUFFIX)
117 aot_libname = $(LIBRARY_NAME)$(PLATFORM_AOT_SUFFIX)
119 ifdef LIBRARY_INSTALL_DIR
121 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
122 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
123 test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
124 ifdef PLATFORM_AOT_SUFFIX
125 test ! -f $(aot_lib) || $(INSTALL_LIB) $(aot_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
129 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
133 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
134 # of the runtime is the same as the GACDIR we want. So, we don't need to pass it
135 # to gacutil. Note that the GACDIR we want may not be the same as the value of
136 # GACDIR set above, since the user could have overridden the value of $(prefix).
138 # This makes a difference only when we're building from the mono/ tree, since we
139 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
142 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
143 gacdir_flag = /gacdir $(GACDIR)
146 ifndef LIBRARY_PACKAGE
148 LIBRARY_PACKAGE = compat-$(FRAMEWORK_VERSION)
150 LIBRARY_PACKAGE = $(FRAMEWORK_VERSION)
154 ifneq (none, $(LIBRARY_PACKAGE))
155 package_flag = /package $(LIBRARY_PACKAGE)
158 install-local: $(gacutil)
159 $(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) $(package_flag)
161 uninstall-local: $(gacutil)
162 -$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) $(package_flag)
164 endif # LIBRARY_INSTALL_DIR
168 -rm -f $(tests_CLEAN_FILES) $(library_CLEAN_FILES) $(CLEAN_FILES)
170 test-local run-test-local run-test-ondotnet-local:
173 DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES)
175 ASSEMBLY = $(LIBRARY)
177 the_assembly = $(the_lib)
178 include $(topdir)/build/tests.make
181 DISTFILES += $(test_sourcefile)
184 # make dist will collect files in .sources files from all profiles
185 dist-local: dist-default
187 for f in `$(topdir)/tools/removecomments.sh $(wildcard *$(LIBRARY).sources)` $(TEST_FILES) ; do \
190 *) dest=`dirname "$$f"` ; \
191 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
192 cp -p "$$f" $(distdir)/$$dest || exit 1 ;; \
194 for d in . $$subs ; do \
195 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
197 ifdef LIBRARY_NEEDS_POSTPROCESSING
198 dist-local: dist-fixup
199 FIXUP_PROFILES = default net_2_0
201 $(MKINSTALLDIRS) $(distdir)/fixup $(FIXUP_PROFILES:%=$(distdir)/fixup/%)
204 ifndef LIBRARY_COMPILE
205 LIBRARY_COMPILE = $(CSCOMPILE)
209 LIBRARY_SNK = $(topdir)/class/mono.snk
213 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
214 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
216 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
222 $(the_lib): $(the_libdir)/.stamp
224 $(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir:=/.stamp)
225 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
226 $(SN) $(SNFLAGS) -R $@ $(LIBRARY_SNK)
228 ifdef LIBRARY_USE_INTERMEDIATE_FILE
229 $(the_lib): $(build_lib)
230 $(Q) cp $(build_lib) $@
231 $(SN) $(SNFLAGS) -v $@
232 $(Q) test ! -f $(build_lib).mdb || mv $(build_lib).mdb $@.mdb
233 $(Q) test ! -f $(build_lib:.dll=.pdb) || mv $(build_lib:.dll=.pdb) $(the_lib:.dll=.pdb)
236 ifdef PLATFORM_AOT_SUFFIX
237 Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";)
238 $(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
239 $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version $(the_lib)
243 ifneq (,$(filter $(AOT_IN_PROFILES), $(PROFILE)))
245 all-local: $(the_lib)$(PLATFORM_AOT_SUFFIX)
250 $(makefrag): $(sourcefile)
251 @echo Creating $@ ...
252 @sed 's,^,$(build_lib): ,' $< >$@
254 ifneq ($(response),$(sourcefile))
255 $(response): $(sourcefile) $(PLATFORM_excludes)
256 @echo Creating $@ ...
257 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
262 # for now, don't give any /lib flags or set MONO_PATH, since we
263 # give a full path to the assembly.
265 ## Include corcompare stuff
266 include $(topdir)/build/corcompare.make
268 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
269 ifneq ($(response),$(sourcefile))
270 $(response): $(topdir)/build/library.make $(depsdir)/.stamp
272 $(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp
274 ## Documentation stuff
276 Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE)] $(notdir $(@))";)
277 MDOC_UP =$(Q_MDOC_UP) \
278 $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe update --delete \
279 -o Documentation/en $(the_lib)
281 doc-update-local: $(the_libdir)/.doc-stamp
283 $(the_libdir)/.doc-stamp: $(the_lib)
285 @echo "doc-stamp" > $@