2005-01-11 Peter Bartok <pbartok@novell.com>
[mono.git] / mcs / build / rules.make
index 1aa11d54cd1cdcdd4052ecbf0c9b1f00eabfc8c2..470856e88c0abcfb3d3c3370223d2d5258806d7b 100644 (file)
@@ -26,15 +26,14 @@ INSTALL_DATA = $(INSTALL) -m 644
 INSTALL_BIN = $(INSTALL) -m 755
 INSTALL_LIB = $(INSTALL_BIN)
 MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
-INTERNAL_MCS = $(RUNTIME) $(topdir)/mcs/mcs.exe
+INTERNAL_MCS = $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/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_RESGEN = $(RUNTIME) $(topdir)/tools/resgen/resgen.exe
 corlib = mscorlib.dll
 
 depsdir = $(topdir)/build/deps
-distdir = $(dots)/$(package)/$(thisdir)
 
 # Make sure these propagate if set manually
 
@@ -109,35 +108,51 @@ STD_TARGETS = test run-test run-test-ondotnet clean install uninstall
 $(STD_TARGETS): %: %-recursive
        $(MAKE) $@-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
+
 %-recursive:
-       @set . $$MAKEFLAGS; \
+       @set . $$MAKEFLAGS; final_exit=:; \
        case $$2 in --unix) shift ;; esac; \
        case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
-       list='$(SUBDIRS)'; for d in $$list ; do \
-           (cd $$d && $(MAKE) $*) || $$dk ; \
-       done
+       list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \
+           (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \
+       done; \
+       $$final_exit
 
-# note: dist-local dep, extra subdirs, we invoke dist-recursive in the subdir too
+ifndef DIST_SUBDIRS
+DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS)
+endif
 dist-recursive: dist-local
-       @list='$(SUBDIRS) $(DIST_ONLY_SUBDIRS)'; for d in $$list ; do \
-           (cd $$d && $(MAKE) $@) || exit 1 ; \
+       @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