New test.
[mono.git] / mcs / build / rules.make
index 2ccedc96ac253383741f1d78525b7650485ded63..7225f0dd1e30fe54f5cac4080d5ade63236708a7 100644 (file)
@@ -15,26 +15,26 @@ topdir := $(dots)
 
 VERSION = 0.93
 
-USE_MCS_FLAGS = $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
-USE_MBAS_FLAGS = $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
+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)
 BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS)
 CCOMPILE = $(CC) $(USE_CFLAGS)
 BOOT_COMPILE = $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
-INSTALL_DATA = $(INSTALL) -m 644
-INSTALL_BIN = $(INSTALL) -m 755
+INSTALL = $(SHELL) $(topdir)/../mono/install-sh
+INSTALL_DATA = $(INSTALL) -c -m 644
+INSTALL_BIN = $(INSTALL) -c -m 755
 INSTALL_LIB = $(INSTALL_BIN)
 MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
-INTERNAL_MCS = $(RUNTIME) $(topdir)/mcs/mcs.exe
-INTERNAL_MBAS = $(RUNTIME) $(topdir)/mbas/mbas.exe
-INTERNAL_GMCS = $(RUNTIME) $(topdir)/gmcs/gmcs.exe
-INTERNAL_ILASM = $(RUNTIME) $(topdir)/ilasm/ilasm.exe
-INTERNAL_RESGEN = $(RUNTIME) $(topdir)/monoresgen/monoresgen.exe
+INTERNAL_MCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/mcs.exe
+INTERNAL_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe
+INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/gmcs/gmcs.exe
+INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
+INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BOOTSTRAP_PROFILE)/resgen.exe
 corlib = mscorlib.dll
 
 depsdir = $(topdir)/build/deps
-distdir = $(dots)/$(package)/$(thisdir)
 
 # Make sure these propagate if set manually
 
@@ -54,6 +54,7 @@ export RESGEN
 # Get this so the platform.make platform-check rule doesn't become the
 # default target
 
+.DEFAULT: all
 default: all
 
 # Get initial configuration. pre-config is so that the builder can
@@ -94,62 +95,67 @@ endif
 include $(topdir)/build/profiles/$(PROFILE).make
 -include $(topdir)/build/config.make
 
-# Simple rules
-
-%-recursive:
-       @set . $$MAKEFLAGS; \
-       case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
-       list='$(SUBDIRS)'; for d in $$list ; do \
-           (cd $$d && $(MAKE) $*) || $$dk ; \
-       done
-
-# note: dist-local dep, extra subdirs, $* has become $@
-
-dist-recursive: dist-local
-       @list='$(SUBDIRS) $(DIST_ONLY_SUBDIRS)'; for d in $$list ; do \
-           (cd $$d && $(MAKE) $@) || exit 1 ; \
-       done
-
-# We do this manually to not have a make[1]: blah message (That is,
-# instead of using a '%: %-recursive %-local' construct.)
-#
-# Let the makefile override these for special situations (running checks
-# in the toplevel makefile, or a directory that needs to be built before
-# its subdirectories).
-
-ifndef OVERRIDE_BARE_TARGETS
-
-all: all-recursive all-local
+ifdef OVERRIDE_TARGET_ALL
+all: all.override
+else
+all: do-all
+endif
 
-install: install-recursive install-local
+STD_TARGETS = test run-test run-test-ondotnet clean install uninstall
 
-test: test-recursive test-local
+$(STD_TARGETS): %: do-%
 
-run-test: run-test-recursive test-local run-test-local
+do-run-test:
+       ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
 
-run-test-ondotnet: run-test-ondotnet-recursive test-local run-test-ondotnet-local
+do-%: %-recursive
+       $(MAKE) $*-local
 
-clean: clean-recursive clean-local
+# The way this is set up, any profile-specific subdirs list should
+# be listed _before_ including rules.make.  However, the default
+# SUBDIRS list can come after, so don't use the eager := syntax when
+# using the defaults.
+PROFILE_SUBDIRS := $($(PROFILE)_SUBDIRS)
+ifndef PROFILE_SUBDIRS
+PROFILE_SUBDIRS = $(SUBDIRS)
+endif
 
-uninstall: uninstall-recursive uninstall-local
+%-recursive:
+       @set . $$MAKEFLAGS; final_exit=:; \
+       case $$2 in --unix) shift ;; esac; \
+       case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
+       list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \
+           (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \
+       done; \
+       $$final_exit
 
+ifndef DIST_SUBDIRS
+DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS)
 endif
+dist-recursive: dist-local
+       @case '$(distdir)' in [\\/$$]* | ?:[\\/]* ) reldir='$(distdir)' ;; *) reldir='../$(distdir)' ;; esac ; \
+       list='$(DIST_SUBDIRS)'; for d in $$list ; do \
+           (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \
+       done
 
-# Can only do this from the top dir
-# ## dist: dist-recursive dist-local
-
-# We invert the test here to not end in an error
-# if ChangeLog doesn't exist.
+# The following target can be used like
 #
-# Note that we error out if we try to dist a nonexistant
-# file. Seems reasonable to me.
-
+#   dist-local: dist-default
+#      ... additional commands ...
+#
+# Notes:
+#  1. we invert the test here to not end in an error if ChangeLog doesn't exist.
+#  2. we error out if we try to dist a nonexistant file.
+#  3. we pick up Makefile, makefile, or GNUmakefile.
 dist-default:
-       -mkdir $(distdir)
+       -mkdir -p $(distdir)
        test '!' -f ChangeLog || cp ChangeLog $(distdir)
-       for f in Makefile $(DISTFILES) ; do \
+       if test -f Makefile; then m=M; fi; \
+       if test -f makefile; then m=m; fi; \
+       if test -f GNUmakefile; then m=GNUm; fi; \
+       for f in $${m}akefile $(DISTFILES) ; do \
            dest=`dirname $(distdir)/$$f` ; \
-           $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
+           $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \
        done
 
 # Useful