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 refsfile
= $(LIBRARY
).references
14 # If the directory contains the per profile include file, generate list file.
15 PROFILE_sources
= $(PROFILE
)_
$(LIBRARY
).sources
16 ifeq ($(wildcard $(PROFILE_sources
)), $(PROFILE_sources
))
17 PROFILE_excludes
= $(wildcard $(PROFILE
)_
$(LIBRARY
).exclude.sources
)
18 sourcefile
= $(depsdir
)/$(PROFILE
)_
$(LIBRARY
).sources
19 $(sourcefile
): $(PROFILE_sources
) $(PROFILE_excludes
)
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
)
41 makefrag
= $(depsdir
)/$(PROFILE
)_
$(LIBRARY
).makefrag
42 the_lib
= $(topdir
)/class
/lib
/$(PROFILE
)/$(LIBRARY_NAME
)
43 the_pdb
= $(the_lib
:.dll
=.pdb
)
44 the_mdb
= $(the_lib
).mdb
45 the_csproj
= $(LIBRARY_NAME
:.dll
=.csproj
)
46 library_CLEAN_FILES
+= $(makefrag
) $(the_lib
) $(the_pdb
) $(the_mdb
) $(sourcefile
) $(refsfile
)
48 ifdef LIBRARY_NEEDS_POSTPROCESSING
49 build_lib
= fixup
/$(PROFILE
)/$(LIBRARY_NAME
)
50 library_CLEAN_FILES
+= $(build_lib
) $(build_lib
:.dll
=.pdb
)
52 build_lib
= $(the_lib
)
56 test_nunit_ref
= -pkg
:nunit
57 library_CLEAN_FILES
+= TestResult
*.xml
60 test_against
= $(the_lib
)
65 test_lib
= $(LIBRARY
:.dll
=_test_
$(PROFILE
).dll
)
66 test_sourcefile
= $(LIBRARY
:.dll
=_test.dll.sources
)
68 test_sourcefile
= $(test_lib
).sources
70 test_pdb
= $(test_lib
:.dll
=.pdb
)
71 test_response
= $(depsdir
)/$(test_lib
).response
72 test_makefrag
= $(depsdir
)/$(test_lib
).makefrag
73 test_flags
= -r
:$(test_against
) $(test_nunit_ref
) $(TEST_MCS_FLAGS
)
74 library_CLEAN_FILES
+= $(LIBRARY
:.dll
=_test
*.dll
) $(LIBRARY
:.dll
=_test
*.pdb
) $(test_response
) $(test_makefrag
)
77 btest_lib
= $(LIBRARY
:.dll
=_btest_
$(PROFILE
).dll
)
78 btest_sourcefile
= $(LIBRARY
:.dll
=_btest.dll.sources
)
80 btest_sourcefile
= $(btest_lib
).sources
82 btest_pdb
= $(btest_lib
:.dll
=.pdb
)
83 btest_response
= $(depsdir
)/$(btest_lib
).response
84 btest_makefrag
= $(depsdir
)/$(btest_lib
).makefrag
85 btest_flags
= -r
:$(test_against
) $(test_nunit_ref
) $(TEST_MBAS_FLAGS
)
86 library_CLEAN_FILES
+= $(LIBRARY
:.dll
=_btest
*.dll
) $(LIBRARY
:.dll
=_btest
*.pdb
) $(btest_response
) $(btest_makefrag
)
89 HAVE_CS_TESTS
:= $(wildcard $(test_sourcefile
))
92 HAVE_VB_TESTS
:= $(wildcard $(btest_sourcefile
))
103 ifdef NO_SIGN_ASSEMBLY
110 ifeq ($(PLATFORM
), win32
)
111 GACDIR
= `cygpath -w $(mono_libdir)`
112 GACROOT
= `cygpath -w $(DESTDIR)$(mono_libdir)`
114 test_flags
+= -d
:WINDOWS
116 GACDIR
= $(mono_libdir
)
117 GACROOT
= $(DESTDIR
)$(mono_libdir
)
121 $(sourcefile
): $(the_csproj
)
122 xsltproc
-o
$@
$(topdir
)/build
/sources.xsl
$<
123 echo
$(EXTRA_SOURCES
) >> $@
125 $(refsfile
): $(the_csproj
)
126 xsltproc
-o
$@
$(topdir
)/build
/references.xsl
$<
128 all-local
: $(the_lib
)
130 install-local
: all-local
131 test-local
: all-local
135 install-local uninstall-local
:
140 ifdef LIBRARY_INSTALL_DIR
142 $(MKINSTALLDIRS
) $(DESTDIR
)$(LIBRARY_INSTALL_DIR
)
143 $(INSTALL_LIB
) $(the_lib
) $(DESTDIR
)$(LIBRARY_INSTALL_DIR
)/$(LIBRARY_NAME
)
144 test ! -f
$(the_lib
).mdb ||
$(INSTALL_LIB
) $(the_lib
).mdb
$(DESTDIR
)$(LIBRARY_INSTALL_DIR
)/$(LIBRARY_NAME
).mdb
147 -rm -f
$(DESTDIR
)$(LIBRARY_INSTALL_DIR
)/$(LIBRARY_NAME
) $(DESTDIR
)$(LIBRARY_INSTALL_DIR
)/$(LIBRARY_NAME
).mdb
151 # If RUNTIME_HAS_CONSISTENT_GACDIR is set, it implies that the internal GACDIR
152 # of the runtime is the same as the GACDIR we want. So, we don't need to pass it
153 # to gacutil. Note that the GACDIR we want may not be the same as the value of
154 # GACDIR set above, since the user could have overridden the value of $(prefix).
156 # This makes a difference only when we're building from the mono/ tree, since we
157 # have to ensure that the internal GACDIR of the in-tree runtime matches where we
160 ifndef RUNTIME_HAS_CONSISTENT_GACDIR
161 gacdir_flag
= /gacdir
$(GACDIR
)
165 $(GACUTIL
) /i
$(the_lib
) /f
$(gacdir_flag
) /root
$(GACROOT
) /package
$(FRAMEWORK_VERSION
)
168 -$(GACUTIL
) /u
$(LIBRARY_NAME
:.dll
=) $(gacdir_flag
) /root
$(GACROOT
) /package
$(FRAMEWORK_VERSION
)
174 -rm -f
$(library_CLEAN_FILES
) $(CLEAN_FILES
)
176 test-local run-test-local run-test-ondotnet-local
:
182 test_assemblies
+= $(test_lib
)
186 test_assemblies
+= $(btest_lib
)
189 ifdef test_assemblies
190 test-local
: $(test_assemblies
)
191 run-test-local
: run-test-lib
192 run-test-ondotnet-local
: run-test-ondotnet-lib
194 ## FIXME: i18n problem in the 'sed' command below
195 run-test-lib
: test-local
197 $(TEST_HARNESS
) $(TEST_HARNESS_FLAGS
) $(LOCAL_TEST_HARNESS_FLAGS
) /output
:TestResult-
$(PROFILE
).log
/exclude
:NotWorking
,ValueAdd
,CAS
,InetAccess
/xml
:TestResult-
$(PROFILE
).xml
$(test_assemblies
) || ok
=false
; \
198 sed
'1,/^Tests run: /d' TestResult-
$(PROFILE
).log
; \
201 run-test-ondotnet-lib
: test-local
203 $(TEST_HARNESS
) $(TEST_HARNESS_FLAGS
) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS
) /exclude
=NotDotNet
,CAS
/output
:TestResult-ondotnet-
$(PROFILE
).log
/xml
:TestResult-ondotnet-
$(PROFILE
).xml
$(test_assemblies
) || ok
=false
; \
204 sed
'1,/^Tests run: /d' TestResult-ondotnet-
$(PROFILE
).log
; \
208 DISTFILES
= $(sourcefile
) $(EXTRA_DISTFILES
)
213 TEST_FILES
+= `sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile)`
214 DISTFILES
+= $(test_sourcefile
)
217 TEST_FILES
+= `sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile)`
218 DISTFILES
+= $(btest_sourcefile
)
221 dist-local
: dist-default
223 for f in
`cat $(sourcefile)` $(TEST_FILES
) ; do \
226 *) dest
=`dirname $$f` ; \
227 case
$$subs in
*" $$dest "*) : ;; *) subs
=" $$dest$$subs" ; $(MKINSTALLDIRS
) $(distdir
)/$$dest ;; esac
; \
228 cp
-p
$$f $(distdir
)/$$dest || exit
1 ;; \
230 for d in .
$$subs ; do \
231 case
$$d in .
) : ;; *) test ! -f
$$d/ChangeLog || cp
-p
$$d/ChangeLog
$(distdir
)/$$d ;; esac
; done
233 ifdef LIBRARY_NEEDS_POSTPROCESSING
234 dist-local
: dist-fixup
235 FIXUP_PROFILES
= default net_2_0
237 $(MKINSTALLDIRS
) $(distdir
)/fixup
$(FIXUP_PROFILES
:%=$(distdir
)/fixup
/%)
240 ifndef LIBRARY_COMPILE
241 LIBRARY_COMPILE
= $(CSCOMPILE
)
245 TEST_COMPILE
= $(CSCOMPILE
)
249 BTEST_COMPILE
= $(BASCOMPILE
)
253 LIBRARY_SNK
= $(topdir
)/class
/mono.snk
258 ifeq (cat
, $(PLATFORM_CHANGE_SEPARATOR_CMD
))
259 BUILT_SOURCES_cmdline
= $(BUILT_SOURCES
)
261 BUILT_SOURCES_cmdline
= `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
267 $(build_lib
): $(response
) $(BUILT_SOURCES
) $(refsfile
)
268 # $(XBUILD) "/property:DelaySign=true;KeyOriginatorFile=../msfinal.pub;OutputPath=$(topdir)/class/lib/$(PROFILE)/" $(the_csproj)
269 $(LIBRARY_COMPILE
) -delaysign
+ -keyfile
:..
/msfinal.pub
$(LIBRARY_FLAGS
) $(LIB_MCS_FLAGS
) -target
:library
-out
:$@
$(BUILT_SOURCES_cmdline
) @
$(refsfile
) @
$(response
)
270 $(SN
) $(SNFLAGS
) $@
$(LIBRARY_SNK
)
272 $(makefrag
): $(sourcefile
)
273 @echo Creating
$@ ...
274 @sed
's,^,$(build_lib): ,' $< >$@
276 ifneq ($(response
),$(sourcefile
))
277 $(response
): $(sourcefile
) $(PLATFORM_excludes
)
278 @echo Creating
$@ ...
279 @
sort $(sourcefile
) $(PLATFORM_excludes
) | uniq
-u |
$(PLATFORM_CHANGE_SEPARATOR_CMD
) >$@
284 # for now, don't give any /lib flags or set MONO_PATH, since we
285 # give a full path to the assembly.
289 $(test_lib
): $(test_dep
) $(test_response
)
290 $(TEST_COMPILE
) -target
:library
-out
:$@
$(test_flags
) @
$(refsfile
) @
$(test_response
)
292 $(test_response
): $(test_sourcefile
)
293 @echo Creating
$@ ...
294 @sed
-e
'/^$$/d' -e
's,^,Test/,' $(test_sourcefile
) |
$(PLATFORM_CHANGE_SEPARATOR_CMD
) >$@
296 $(test_makefrag
): $(test_response
)
297 @echo Creating
$@ ...
298 @sed
's,^,$(test_lib): ,' $< >$@
300 -include $(test_makefrag
)
306 $(btest_lib
): $(test_dep
) $(btest_response
)
307 $(BTEST_COMPILE
) -target
:library
-out
:$@
$(btest_flags
) @
$(btest_response
)
309 $(btest_response
): $(btest_sourcefile
)
310 @echo Creating
$@ ...
311 @sed
-e
'/^$$/d' -e
's,^,Test/,' $(btest_sourcefile
) |
$(PLATFORM_CHANGE_SEPARATOR_CMD
) >$@
313 $(btest_makefrag
): $(btest_response
)
314 @echo Creating
$@ ...
315 @sed
's,^,$(btest_lib): ,' $< >$@
317 -include $(btest_makefrag
)
321 all-local
: $(makefrag
) $(test_makefrag
) $(btest_makefrag
)
322 $(makefrag
) $(test_makefrag
) $(btest_makefrag
): $(topdir
)/build
/library.make
325 echo
"../../build/common/Consts.cs" > $(LIBRARY
).sources
326 echo
"../../build/common/MonoTODOAttribute.cs" >> $(LIBRARY
).sources
327 ls
*/*.cs
>> $(LIBRARY
).sources
328 cd Test
; ls
*/*.cs
> ..
/$(LIBRARY
:.dll
=_test.dll
).sources
; cd ..