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)/
56 build_lib = $(build_libdir)$(LIBRARY_NAME)
57 library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
59 build_lib = $(the_lib)
62 ifdef NO_SIGN_ASSEMBLY
65 sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
66 SN = $(Q) MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
70 ifeq ($(PLATFORM), win32)
71 GACDIR = `cygpath -w $(mono_libdir)`
72 GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
73 test_flags += -d:WINDOWS
75 GACDIR = $(mono_libdir)
76 GACROOT = $(DESTDIR)$(mono_libdir)
81 install-local: all-local
86 install-local uninstall-local:
91 ifdef LIBRARY_INSTALL_DIR
93 $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
94 $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
95 test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
98 -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
102 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
103 # of the runtime is the same as the GACDIR we want. So, we don't need to pass it
104 # to gacutil. Note that the GACDIR we want may not be the same as the value of
105 # GACDIR set above, since the user could have overridden the value of $(prefix).
107 # This makes a difference only when we're building from the mono/ tree, since we
108 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
111 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
112 gacdir_flag = /gacdir $(GACDIR)
115 ifndef LIBRARY_PACKAGE
117 LIBRARY_PACKAGE = compat-$(FRAMEWORK_VERSION)
119 LIBRARY_PACKAGE = $(FRAMEWORK_VERSION)
123 ifneq (none, $(LIBRARY_PACKAGE))
124 package_flag = /package $(LIBRARY_PACKAGE)
127 install-local: $(gacutil)
128 $(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) $(package_flag)
130 uninstall-local: $(gacutil)
131 -$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) $(package_flag)
133 endif # LIBRARY_INSTALL_DIR
137 -rm -f $(tests_CLEAN_FILES) $(library_CLEAN_FILES) $(CLEAN_FILES)
139 test-local run-test-local run-test-ondotnet-local:
142 DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES)
144 ASSEMBLY = $(LIBRARY)
146 the_assembly = $(the_lib)
147 include $(topdir)/build/tests.make
150 DISTFILES += $(test_sourcefile)
153 # make dist will collect files in .sources files from all profiles
154 dist-local: dist-default
156 for f in `$(topdir)/tools/removecomments.sh $(wildcard *$(LIBRARY).sources)` $(TEST_FILES) ; do \
159 *) dest=`dirname $$f` ; \
160 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
161 cp -p $$f $(distdir)/$$dest || exit 1 ;; \
163 for d in . $$subs ; do \
164 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
166 ifdef LIBRARY_NEEDS_POSTPROCESSING
167 dist-local: dist-fixup
168 FIXUP_PROFILES = default net_2_0
170 $(MKINSTALLDIRS) $(distdir)/fixup $(FIXUP_PROFILES:%=$(distdir)/fixup/%)
173 ifndef LIBRARY_COMPILE
174 LIBRARY_COMPILE = $(CSCOMPILE)
178 LIBRARY_SNK = $(topdir)/class/mono.snk
183 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
188 cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
192 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
193 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
195 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
199 Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";)
203 $(the_lib): $(the_libdir)/.stamp
205 $(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir:=/.stamp)
206 ifdef LIBRARY_USE_INTERMEDIATE_FILE
207 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$(LIBRARY_NAME) $(BUILT_SOURCES_cmdline) @$(response)
208 $(SN) $(SNFLAGS) $(LIBRARY_NAME) $(LIBRARY_SNK)
209 $(Q) mv $(LIBRARY_NAME) $@
210 $(Q) test ! -f $(LIBRARY_NAME).mdb || mv $(LIBRARY_NAME).mdb $@.mdb
211 $(Q) test ! -f $(LIBRARY_NAME:.dll=.pdb) || mv $(LIBRARY_NAME:.dll=.pdb) $(dir $@)$(LIBRARY_NAME:.dll=.pdb)
213 $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
214 $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
217 ifneq (,$(filter $(AOT_IN_PROFILES), $(PROFILE)))
218 $(Q_AOT) MONO_PATH=$(the_libdir) $(RUNTIME) --aot=bind-to-runtime-version $@ > $(PROFILE)_aot.log 2>&1
222 $(makefrag): $(sourcefile)
223 @echo Creating $@ ...
224 @sed 's,^,$(build_lib): ,' $< >$@
226 ifneq ($(response),$(sourcefile))
227 $(response): $(sourcefile) $(PLATFORM_excludes)
228 @echo Creating $@ ...
229 @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
234 # for now, don't give any /lib flags or set MONO_PATH, since we
235 # give a full path to the assembly.
237 ## Include corcompare stuff
238 include $(topdir)/build/corcompare.make
240 all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
241 ifneq ($(response),$(sourcefile))
242 $(response): $(topdir)/build/library.make $(depsdir)/.stamp
244 $(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp
246 ## Documentation stuff
248 Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE)] $(notdir $(@))";)
249 MDOC_UP =$(Q_MDOC_UP) \
250 if `echo $(PROFILE) | grep ^net_1_ > /dev/null 2>/dev/null` ; then \
251 $(RUNTIME) $(topdir)/tools/mdoc/monodocer1.exe \
252 -path:Documentation/en -assembly:$(the_lib) ; \
254 $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe update --delete \
255 -o Documentation/en $(the_lib) ; \
258 doc-update-local: $(the_libdir)/.doc-stamp
260 $(the_libdir)/.doc-stamp: $(the_lib)
262 @echo "doc-stamp" > $@