From 93bb2e250d17c2ae5666c83b7f3e3b6a0938f112 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 16 Jan 2001 17:47:10 +0000 Subject: [PATCH] [project @ 2001-01-16 17:47:10 by simonmar] 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 | 31 +++++++++++++++++++++++++++++++ README | 1 - mk/config.mk.in | 31 +++++++++++++------------------ mk/target.mk | 9 ++++++++- 4 files changed, 52 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 413a260..439aee6 100644 --- 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 --- 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 diff --git a/mk/config.mk.in b/mk/config.mk.in index c2b9ce1..2fe53d5 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -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? diff --git a/mk/target.mk b/mk/target.mk index 287fa40..6f7d923 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -79,7 +79,14 @@ 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)" -- 1.7.10.4