another endian fix
[mono.git] / mcs / build / library.make
index 919c90f4bcee3d00b5b1a481a3e6cb570cff2e38..3d94ab9709b5ad7a0b6e4faeb59d18f15e1ba5ea 100644 (file)
@@ -9,6 +9,18 @@
 # munge in the library name to keep the files from clashing.
 
 sourcefile = $(LIBRARY).sources
+
+# If the directory contains the per profile include file, generate list file.
+PROFILE_sources = $(PROFILE)_$(LIBRARY).sources
+ifeq ($(wildcard $(PROFILE_sources)), $(PROFILE_sources))
+PROFILE_excludes = $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)
+COMMON_sourcefile := $(sourcefile)
+sourcefile = $(depsdir)/$(PROFILE)_$(LIBRARY).sources
+$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(COMMON_sourcefile)
+       @echo Creating the per profile list $@ ...
+       $(topdir)/tools/gensources.sh $(PROFILE_sources) $(PROFILE_excludes) > $@
+endif
+
 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
 
 ifndef PLATFORM_excludes
@@ -32,6 +44,13 @@ the_pdb = $(the_lib:.dll=.pdb)
 the_mdb = $(the_lib).mdb
 library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_mdb)
 
+ifdef LIBRARY_NEEDS_POSTPROCESSING
+build_lib = fixup/$(PROFILE)/$(LIBRARY_NAME)
+library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
+else
+build_lib = $(the_lib)
+endif
+
 ifndef NO_TEST
 test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
 test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
@@ -52,7 +71,7 @@ endif
 test_pdb = $(test_lib:.dll=.pdb)
 test_response = $(depsdir)/$(test_lib).response
 test_makefrag = $(depsdir)/$(test_lib).makefrag
-test_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
+test_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
 library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
 
 ifndef btest_lib
@@ -64,7 +83,7 @@ endif
 btest_pdb = $(btest_lib:.dll=.pdb)
 btest_response = $(depsdir)/$(btest_lib).response
 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
-btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
+btest_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
 library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
 
 ifndef HAVE_CS_TESTS
@@ -80,24 +99,24 @@ ifdef NO_INSTALL
 GACUTIL = :
 else
 gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
-GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(gacutil)
+GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
 endif
 
 ifdef NO_SIGN_ASSEMBLY
 SN = :
 else
 sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
-SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(sn)
+SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
 SNFLAGS = -q -R
 endif
 
 ifeq ($(PLATFORM), win32)
-GACDIR = `cygpath -w $(libdir)`
-GACROOT = `cygpath -w $(DESTDIR)$(libdir)`
+GACDIR = `cygpath -w $(mono_libdir)`
+GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
 test_flags += -d:WINDOWS
 else
-GACDIR = $(libdir)
-GACROOT = $(DESTDIR)$(libdir)
+GACDIR = $(mono_libdir)
+GACROOT = $(DESTDIR)$(mono_libdir)
 endif
 
 all-local: $(the_lib)
@@ -203,11 +222,23 @@ DISTFILES += $(btest_sourcefile)
 endif
 
 dist-local: dist-default
+       subs=' ' ; \
        for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
          case $$f in \
          ../*) : ;; \
-         *) dest=`dirname $(distdir)/$$f` ; $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ;; \
-         esac ; done
+         *) dest=`dirname $$f` ; \
+            case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
+            cp -p $$f $(distdir)/$$dest || exit 1 ;; \
+         esac ; done ; \
+       for d in . $$subs ; do \
+         case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
+
+ifdef LIBRARY_NEEDS_POSTPROCESSING
+dist-local: dist-fixup
+FIXUP_PROFILES = default net_2_0
+dist-fixup:
+       $(MKINSTALLDIRS) $(distdir)/fixup $(FIXUP_PROFILES:%=$(distdir)/fixup/%)
+endif
 
 ifndef LIBRARY_COMPILE
 LIBRARY_COMPILE = $(CSCOMPILE)
@@ -245,20 +276,21 @@ endif
 
 # The library
 
-$(the_lib): $(response) $(sn) $(BUILT_SOURCES)
+$(build_lib): $(response) $(sn) $(BUILT_SOURCES)
 ifdef LIBRARY_USE_INTERMEDIATE_FILE
-       $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(@F) $(BUILT_SOURCES_cmdline) @$(response)
-       $(SN) $(SNFLAGS) $(@F) $(LIBRARY_SNK)
-       mv $(@F) $@
-       test ! -f $(@F).mdb || mv $(@F).mdb $@.mdb
+       $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$(LIBRARY_NAME) $(BUILT_SOURCES_cmdline) @$(response)
+       $(SN) $(SNFLAGS) $(LIBRARY_NAME) $(LIBRARY_SNK)
+       mv $(LIBRARY_NAME) $@
+       test ! -f $(LIBRARY_NAME).mdb || mv $(LIBRARY_NAME).mdb $@.mdb
+       test ! -f $(LIBRARY_NAME:.dll=.pdb) || mv $(LIBRARY_NAME:.dll=.pdb) $(dir $@)$(LIBRARY_NAME:.dll=.pdb)
 else
-       $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ $(BUILT_SOURCES_cmdline) @$(response)
+       $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
        $(SN) $(SNFLAGS) $@ $(LIBRARY_SNK)
 endif
 
 $(makefrag): $(sourcefile)
        @echo Creating $@ ...
-       @sed 's,^,$(the_lib): ,' $< >$@
+       @sed 's,^,$(build_lib): ,' $< >$@
 
 ifneq ($(response),$(sourcefile))
 $(response): $(sourcefile) $(PLATFORM_excludes)
@@ -274,7 +306,7 @@ endif
 ifdef HAVE_CS_TESTS
 
 $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
-       $(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
+       $(TEST_COMPILE) -target:library -out:$@ $(test_flags) @$(test_response)
 
 $(test_response): $(test_sourcefile)
        @echo Creating $@ ...
@@ -291,7 +323,7 @@ endif
 ifdef HAVE_VB_TESTS
 
 $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
-       $(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
+       $(BTEST_COMPILE) -target:library -out:$@ $(btest_flags) @$(btest_response)
 
 $(btest_response): $(btest_sourcefile)
        @echo Creating $@ ...