[project @ 2001-01-16 17:47:10 by simonmar]
authorsimonmar <unknown>
Tue, 16 Jan 2001 17:47:10 +0000 (17:47 +0000)
committersimonmar <unknown>
Tue, 16 Jan 2001 17:47:10 +0000 (17:47 +0000)
Change the way the top-level Makefile works, now that we have a
dependency between ghc and hslibs which means that you can't `make
boot' in hslibs until you've done `make all' in ghc.

  - now you just type `make all' at the top-level, and the makefile
    arranges to do `make boot all' in each of the subdirectories.
    Typing `make boot' at the top-level now yields a message explaining
    what's going on.

  - Now it's no longer necessary to set $(ProjectsToBuild).  If you don't
    set it, the build system attempts to build all the projects in
    the source tree, in the order determined by $(AllProjects) in
    config.mk.  I've been meaning to fix this for ages, since it meant
    that one had to hand-edit config.mk.in when making a distribution
    for anything other than GHC - this is no longer the case.

    You still *can* set ProjectsToBuild if you want to, however.

  - ProjectsToInstall has been replaced by ProjectsDontInstall, and
    has the obvious, reverse, meaning.  It also has a reasonable default,
    so the need to set it should be rare.

All this has the obvious benefit that to build GHC you need one fewer
commands (no more `make boot'), and anyone that has "./configure &&
make && make install" hardwired into their brains will feel right at
home.

Makefile
README
mk/config.mk.in
mk/target.mk

index 413a260..439aee6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -282,5 +282,36 @@ DIST_CLEAN_FILES += config.cache config.status
 
 MAINTAINER_CLEAN_FILES += configure
 
+ifeq "$(ProjectsToBuild)" ""
+Projects = $(AllProjects)
+else
+Projects = $(filter $(ProjectsToBuild), $(AllProjects))
+endif
+
+all ::
+       @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
+       for i in $(Projects); do \
+          if [ -d $$i ]; then \
+             $(MAKE) -C $$i boot all; \
+             if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ;  then true; else exit 1; fi; \
+             fi; \
+       done
+
+boot ::
+       @echo "Please use \`make all' only from the top-level, or \`make boot' followed"
+       @echo "by \`make all' in an individual project subdirectory (ghc, hslibs etc.)."
+
+install ::
+       @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
+       for i in $(filter-out $(ProjectsDontInstall), $(AllProjects)); do \
+          if [ -d $$i ]; then \
+             $(MAKE) -C $$i boot all; \
+             if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ;  then true; else exit 1; fi; \
+             fi; \
+       done
+
+NO_ALL_TARGETS=YES
 include $(TOP)/mk/target.mk
 
+# -----------------------------------------------------------------------------
+
diff --git a/README b/README
index 5aab572..dcdaaff 100644 (file)
--- a/README
+++ b/README
@@ -28,7 +28,6 @@ In addition, the following directories contain project-independent bits:
 Quick start:  the following is *supposed* to work
 
        $ ./configure
-       $ make boot
        $ make
        $ make install
 
index c2b9ce1..2fe53d5 100644 (file)
@@ -97,29 +97,24 @@ exeext=@exeext@
 #
 ################################################################################
 
-#
-# What parts to build: An fptools build tree does not have to be built
-# all in one go. By setting the list of ProjectsToBuild in build.mk you can
-# control which projects are built.
-#
-# Caution: the projects are built in the order given here, so if some
-# projects use others you must list them in the correct order.
-#
-# Generally:   * glafp-utils should be first
-#              * happy next
-#              * ghc next
-#              then it's up to you
-
+# build the libs first if we're bootstrapping from .hc files
 ifeq "$(GhcWithHscBuiltViaC)" "YES"
-# need hslibs/lang first if we're bootstrapping
-ProjectsToBuild   = glafp-utils hslibs ghc
+AllProjects = glafp-utils hslibs ghc green-card happy hdirect hood nofib
 else
-ProjectsToBuild   = glafp-utils ghc hslibs
+AllProjects = glafp-utils ghc hslibs green-card happy hdirect hood nofib
 endif
+
+#
+# (OPTIONAL) set ProjectsToBuild to a list of projects to be built.  If this
+# list is empty, then all projects present in the source tree will be built.
+#
+ProjectsToBuild =
+
 #
-# Make a distinction between building and installing
+# set ProjectsDontInstall to a list of projects which are normally built but
+# not installed.
 #
-ProjectsToInstall = glafp-utils ghc hslibs
+ProjectsDontInstall = glafp-utils nofib
 
 #
 # Should the various project tests directories be built?
index 287fa40..6f7d923 100644 (file)
 
 ifneq "$(SUBDIRS)" ""
 
-all docs runtests boot TAGS clean distclean mostlyclean maintainer-clean install html ps dvi txt::
+# we override the boot & all targets in the top level Makefile
+ifneq "$(NO_ALL_TARGETS)" "YES"
+ALL     = all
+BOOT    = boot
+INSTALL = install
+endif
+
+$(ALL) docs runtests $(BOOT) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL) html ps dvi txt::
        @echo "------------------------------------------------------------------------"
        @echo "===fptools== Recursively making \`$@' in $(SUBDIRS) ..."
        @echo "PWD = $(shell pwd)"