2009-02-19 Jb Evain <jbevain@novell.com>
[mono.git] / mcs / build / rules.make
index 684f93708a81319d36a51f8f929efba29ce1a8e8..6ae775504630c9942884a645c63624dea2a8667d 100644 (file)
@@ -7,21 +7,30 @@
 # If you need to edit this file, that's a bug; email
 # peter@newton.cx about it.
 
-# Some more variables. The leading period in the sed expression prevents
-# thisdir = . from being changed into '..' for the toplevel directory.
+empty :=
+space := $(empty) $(empty)
 
-dots := $(shell echo $(thisdir) |sed -e 's,[^./][^/]*,..,g')
-topdir := $(dots)
+# given $(thisdir), we compute the path to the top directory
+#
+# split_path = $(filter-out .,$(subst /,$(space),$(1)))
+# make_path = ./$(subst $(space),/,$(1))
+# dotdottify = $(patsubst %,..,$(1))
+# topdir = $(call make_path,$(call dotdottify,$(call split_path,$(thisdir))))
+topdir := ./$(subst $(space),/,$(patsubst %,..,$(filter-out .,$(subst /,$(space),$(thisdir)))))
 
 VERSION = 0.93
 
+Q=$(if $(V),,@)
+# echo -e "\\t" does not work on some systems, so use 5 spaces
+Q_MCS=$(if $(V),,@echo "MCS     [$(PROFILE)] $(notdir $(@))";)
+
 USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
 USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
 USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
-CSCOMPILE = $(MCS) $(USE_MCS_FLAGS)
+CSCOMPILE = $(Q_MCS) $(MCS) $(USE_MCS_FLAGS)
 BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS)
 CCOMPILE = $(CC) $(USE_CFLAGS)
-BOOT_COMPILE = $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
+BOOT_COMPILE = $(Q_MCS) $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
 INSTALL = $(SHELL) $(topdir)/../mono/install-sh
 INSTALL_DATA = $(INSTALL) -c -m 644
 INSTALL_BIN = $(INSTALL) -c -m 755
@@ -108,7 +117,7 @@ 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) $(RUNTIME_FLAGS) $(gacutil)
 endif
 
-STD_TARGETS = test run-test run-test-ondotnet clean install uninstall
+STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
 
 $(STD_TARGETS): %: do-%
 
@@ -168,6 +177,11 @@ dist-default:
            dest=`dirname $(distdir)/$$f` ; \
            $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \
        done
+       if test -d Documentation ; then \
+               find . -name '*.xml' > .files ; \
+               tar cTf .files - | (cd $(distdir); tar xf -) ; \
+               rm .files ; \
+       fi
 
 %/.stamp:
        $(MKINSTALLDIRS) $(@D)
@@ -177,3 +191,9 @@ dist-default:
 
 withmcs:
        $(MAKE) MCS='$(INTERNAL_MCS)' BOOTSTRAP_MCS='$(INTERNAL_MCS)' all
+
+## Documentation stuff
+
+Q_MDOC =$(if $(V),,@echo "MDOC    [$(PROFILE)] $(notdir $(@))";)
+MDOC   =$(Q_MDOC) MONO_PATH="$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_1_1$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe
+