TARGET_J2EE/JVM fixes
[mono.git] / mcs / class / corlib / Makefile
index 8ef5971103bbdf7cb66d69167bedad18e6336b3b..69772f5f70407925943c0955bdd69a62cf1d32b4 100644 (file)
 thisdir = class/corlib
 SUBDIRS =
 include ../../build/rules.make
+export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
+
+RESOURCE_FILES = \
+       resources/collation.core.bin \
+       resources/collation.tailoring.bin \
+       resources/collation.cjkCHS.bin \
+       resources/collation.cjkCHT.bin \
+       resources/collation.cjkJA.bin \
+       resources/collation.cjkKO.bin \
+       resources/collation.cjkKOlv2.bin
+
+corlib_flags = -unsafe -nostdlib
+LOCAL_MCS_FLAGS = -nowarn:169,612,618,649 -d:INSIDE_CORLIB
+
+ifneq ($(FRAMEWORK_VERSION),1.0)
+LOCAL_MCS_FLAGS += -nowarn:414
+endif
 
-real_corlib := $(corlib)
-
-# corlib is crazy to build so we skip build/library.make and do stuff
-# ourselves.
+LIBRARY = corlib.dll
+LIBRARY_NAME = mscorlib.dll
+LIB_MCS_FLAGS = $(corlib_flags) $(RESOURCE_FILES:%=/resource:%)
+LIBRARY_USE_INTERMEDIATE_FILE = yes
+
+LIBRARY_COMPILE = $(BOOT_COMPILE)
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+
+EXTRA_DISTFILES = \
+       corlib.dll.win32-excludes corlib_cmp.dll.excludes corlib_res.dll.excludes \
+       $(plattestlib).excludes                 \
+       Test/ms_run_test.sh                     \
+       Test/resources/MyResources.resources    \
+       Test/resources/Empty.resources          \
+       Test/resources/AFile.txt                        \
+       $(RESOURCE_FILES)
+
+CLEAN_FILES = $(cmplib) $(reslib) $(plattestlib) $(plattestlib).sources \
+              $(cmp_response) $(cmp_makefrag) \
+              $(res_response) $(res_makefrag) \
+              $(cmppdb) $(respdb) $(plattestpdb)
+
+# If building on a non mono-native platform, default
+# to running the unit tests on its corlib, to see if
+# our tests are complaint with their (hopefully bug-free)
+# corlib. If on a mono-native platform, test our actual
+# corlib.
 #
-# Here, we define a bunch of variables.
-
-corlib = $(topdir)/class/lib/corlib.dll
-testlib = corlib_test.dll
-cmplib = $(topdir)/class/lib/corlib_cmp.dll
-
-corpdb = $(patsubst %.dll,%.pdb,$(corlib))
-testpdb = $(patsubst %.dll,%.pdb,$(testlib))
-cmppdb = $(patsubst %.dll,%.pdb,$(cmplib))
-
-sourcefile = corlib.dll.sources
-response = $(depsdir)/corlib.dll.response
-makefrag = $(depsdir)/corlib.dll.makefrag
-stampfile = $(depsdir)/corlib.dll.stamp
-corlib_flags = /unsafe /nostdlib /d:INSIDE_CORLIB
-
-test_sourcefile = corlib_test.dll.sources
-test_response = $(depsdir)/$(testlib).response
-test_makefrag = $(depsdir)/$(testlib).makefrag
-test_stampfile = $(depsdir)/$(testlib).stamp
-test_flags = /nowarn:0618 /nowarn:0672 /r:$(corlib) /r:$(topdir)/class/lib/NUnit.Framework.dll
-
-cmp_response = $(depsdir)/corlib_cmp.dll.response
-cmp_makefrag = $(depsdir)/corlib_cmp.dll.makefrag
-cmp_stampfile = $(depsdir)/corlib_cmp.dll.stamp
-cmp_flags = /r:$(real_corlib) $(corlib_flags)
+# You can access either one on demand with either 'make
+# run-monotest' or 'make run-plattest'.
 
-# Here, we make all.
+plattestlib = corlib_plattest.dll
+plattestpdb = $(patsubst %.dll,%.pdb,$(plattestlib))
+$(plattestlib).sources: corlib_test.dll.sources $(plattestlib).excludes
+       sort corlib_test.dll.sources $(plattestlib).excludes | uniq -u >$@
 
-all-local: $(corlib)
-
-install-local: $(corlib)
-       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib
-       $(INSTALL_LIB) $(corlib) $(DESTDIR)$(prefix)/lib
-
-clean-local:
-       -rm -f $(corlib) $(cmplib) $(testlib) TestResult.xml \
-              $(response) $(makefrag) $(stampfile) \
-              $(test_response) $(test_makefrag) $(test_stampfile) \
-              $(corpdb) $(cmppdb) $(testpdb) \
-              $(cmp_response) $(cmp_makefrag) $(cmp_stampfile)
-
-
-test-local: $(corlib) $(testlib)
-
-run-test-local:
-       $(TEST_RUNTIME) $(TEST_HARNESS) $(testlib)
-
-# OK, that was the easy part. Now we get to the fun bits.
-#
-# first, make dist.
+TEST_MCS_FLAGS = -debug+ -debug:full -nowarn:168,219,618,672 -unsafe
 
-DISTFILES = $(sourcefile) $(test_sourcefile) \
-       corlib.dll.win32-excludes corlib_cmp.dll.excludes Test/ms_run_test.sh
+ifndef PLATFORM_MONO_NATIVE
+test_lib = $(plattestlib)
+test_against = $(PLATFORM_CORLIB)
+HAVE_CS_TESTS = $(plattestlib).sources
 
-# see $(topdir)/build/library.make for explanation of what's going on
-# here.
+## for now, compiling the testsuite with CSC causes CS0583.  So compile with internal MCS
+TEST_COMPILE = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS) $(USE_MCS_FLAGS)
+endif
 
-dist-local: dist-default
-       for f in `cat $(sourcefile)` `cat $(test_sourcefile) |sed -e 's,^\(.\),Test/\1,'` ; do \
-           dest=`dirname $(distdir)/$$f` ; \
-           $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
-       done
+include ../../build/library.make
 
-# plain ol corlib
+ifndef PLATFORM_MONO_NATIVE
+run-monotest:
+       $(MAKE) $(reslib)
+       $(MAKE) test_lib=corlib_test.dll test_against=$(reslib) run-test
 
-$(corlib): $(makefrag) $(response) $(stampfile)
-       $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(corlib_flags) /target:library /out:$@ @$(response)
+run-plattest:
+       $(MAKE) test_lib=$(plattestlib) test_against='$(PLATFORM_CORLIB)' run-test
 
-$(response): $(sourcefile)
-       @echo Creating $@ ...
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-       @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 else
-       @cat $< |$(PLATFORM_TWEAK_CORLIB_SOURCES) >$@
-endif
-
-$(makefrag): $(response)
-       @echo Creating $@ ...
-       @echo "HAVE_MAKEFRAG = yes" >$@.new
-       @echo "$(stampfile): \\" >>$@.new
-       @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
-       @cat $@.new |sed -e '$$s, \\$$,,' >$@
-       @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
-       @rm -rf $@.new
-
--include $(makefrag)
-
-ifndef HAVE_MAKEFRAG
-$(stampfile):
-       touch $@
+run-monotest: run-test
 endif
 
 # corlib_cmp
+cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
+cmppdb = $(cmplib:.dll=.pdb)
+cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
+cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
+cmp_flags = -r:$(PLATFORM_CORLIB) $(corlib_flags)
 
-$(cmplib): $(cmp_makefrag) $(cmp_response) $(cmp_stampfile)
-       $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) /target:library /out:$@ @$(cmp_response)
+$(cmplib): $(cmp_makefrag) $(cmp_response)
+       $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) -target:library -out:$@ @$(cmp_response)
 
-$(cmp_response): $(response) corlib_cmp.dll.excludes
+$(cmp_response): $(sourcefile) corlib_cmp.dll.excludes
        @echo Creating $@ ...
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-       @cat corlib_cmp.dll.excludes |$(PLATFORM_CHANGE_SEPARATOR_CMD) |cat - $< |sort |uniq -u >$@
-else
-       @cat corlib_cmp.dll.excludes |cat - $< |sort |uniq -u >$@
-endif
+       @sort $(sourcefile) corlib_cmp.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 
 $(cmp_makefrag): $(cmp_response)
        @echo Creating $@ ...
-       @echo "HAVE_CMP_MAKEFRAG = yes" >$@.new
-       @echo "$(cmp_stampfile): \\" >>$@.new
-       @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
-       @cat $@.new |sed -e '$$s, \\$$,,' >$@
-       @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
-       @rm -rf $@.new
+       @sed 's,^,$(cmplib): ,' $< >$@
 
 # Since we make corlib_cmp on demand, there isn't a real need
 # to have full dep tracking for it. Also, the generation of this
@@ -129,36 +105,23 @@ $(cmp_makefrag): $(cmp_response)
 #
 # -include $(cmp_makefrag)
 
-ifndef HAVE_CMP_MAKEFRAG
-$(cmp_stampfile):
-       touch $@
-endif
-
-# corlib_test
+# corlib_res
+reslib = $(topdir)/class/lib/$(PROFILE)/corlib_res.dll
+respdb = $(reslib:.dll=.pdb)
+res_response = $(depsdir)/$(PROFILE)_corlib_res.dll.response
+res_makefrag = $(depsdir)/$(PROFILE)_corlib_res.dll.makefrag
+res_flags = -r:$(PLATFORM_CORLIB) $(corlib_flags)
 
-$(testlib): $(test_makefrag) $(test_response) $(test_stampfile)
-       $(CSCOMPILE) $(test_flags) /target:library /out:$@ @$(test_response)
+$(reslib): $(res_makefrag) $(res_response)
+       $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(res_flags) -target:library -out:$@ @$(res_response)
 
-$(test_response): $(test_sourcefile)
+$(res_response): $(sourcefile) corlib_res.dll.excludes
        @echo Creating $@ ...
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-       @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
-else
-       @cat $< |sed -e 's,^\(.\),Test/\1,' >$@
-endif
+       @sort $(sourcefile) corlib_res.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 
-$(test_makefrag): $(test_response)
+# warning: embedded tab in the 'echo touch' line
+$(res_makefrag): $(res_response)
        @echo Creating $@ ...
-       @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new
-       @echo "$(test_stampfile): \\" >>$@.new
-       @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
-       @cat $@.new |sed -e '$$s, \\$$,,' >$@
-       @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
-       @rm -rf $@.new
-
--include $(test_makefrag)
-
-ifndef HAVE_TEST_MAKEFRAG
-$(test_stampfile):
-       touch $@
-endif
+       @sed 's,^,$(reslib): ,' $< >$@
+
+-include $(res_makefrag)