Commit 4a73af53 authored by Ian Lynagh's avatar Ian Lynagh

Update the build system to handle building and using haddock2

One side-effect of this is that we need to build the install-utils with
stage2 rather than stage1 as we need the ghc package.
parent c35325dd
......@@ -125,7 +125,6 @@ stage1 : $(GCC_LIB_DEP) check-all
$(MAKE) -C rts boot
$(MAKE) -C rts
$(MAKE) -C libraries all
$(MAKE) -C utils with-stage-1
# When making distributions (i.e., whether with binary-dist or using the
# vanilla install target to create an installer package), we can have problems
......@@ -137,8 +136,10 @@ stage1 : $(GCC_LIB_DEP) check-all
stage2 : check-all
$(MAKE) -C compiler stage=2 boot
$(MAKE) -C compiler stage=2
$(MAKE) -C utils with-stage-2
ifeq "$(HADDOCK_DOCS)" "YES"
$(MAKE) -C compiler stage=2 doc
$(MAKE) -C libraries doc
$(MAKE) -C compiler doc stage=2
endif
stage3 : check-all
......
......@@ -199,7 +199,9 @@ build.stage.%:
$(MAKE) -C ../ghc stage=$*
doc.stage.%:
$(CABAL) haddock --distpref dist-stage$*
$(CABAL) haddock --distpref dist-stage$* \
--haddock-option=--optghc=-DSTAGE=$* \
--with-haddock=$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace/bin/haddock
# XXX We ought to actually install the (stage 2) library
install:
......
......@@ -197,10 +197,6 @@ endif
all: build
ifeq "$(HADDOCK_DOCS)" "YES"
all: doc
endif
.PHONY: rebuild.library.%
.PHONY: remake.library.%
......@@ -297,7 +293,7 @@ doc: $(foreach SUBDIR,$(DOC_SUBDIRS),doc.library.$(SUBDIR))
ifneq "$(HSCOLOUR)" ""
CABAL_HADDOCK_FLAGS += --hyperlink-source
endif
CABAL_HADDOCK_FLAGS += --with-haddock=$(FPTOOLS_ABS_TOP)/utils/haddock/install-inplace/bin/haddock
CABAL_HADDOCK_FLAGS += --with-haddock=$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace/bin/haddock
$(foreach SUBDIR,$(DOC_SUBDIRS),doc.library.$(SUBDIR)):\
doc.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
......
......@@ -2,6 +2,7 @@
set -e
HADDOCK=../utils/haddock/install-inplace/bin/haddock
HADDOCK_ARGS=
NAMES=
......@@ -22,9 +23,9 @@ do
done
# Now create the combined contents and index pages
haddock --gen-index --gen-contents -o . \
-t "Haskell Hierarchical Libraries" \
$HADDOCK_ARGS
$HADDOCK --gen-index --gen-contents -o . \
-t "Haskell Hierarchical Libraries" \
$HADDOCK_ARGS
# Unhandled Windows help stuff?:
......
......@@ -29,10 +29,6 @@ ifneq "$(ALEX)" ""
COMMON_CONFIGURE_FLAGS += --with-alex=$(ALEX)
endif
ifneq "$(HADDOCK)" ""
COMMON_CONFIGURE_FLAGS += --with-haddock=$(HADDOCK)
endif
ifneq "$(HAPPY)" ""
COMMON_CONFIGURE_FLAGS += --with-happy=$(HAPPY)
endif
......
......@@ -14,14 +14,14 @@ INSTALL_FLAGS =
endif
endif
# Tell stage1 to make a dynamically-linked binary, but no wrapper. We assume
# Tell stage2 to make a dynamically-linked binary, but no wrapper. We assume
# that in an installation the shared libs will be installed somewhere that
# the system can find them.
ifeq "$(BuildSharedLibs)" "YES"
DYN_FLAGS = --ghc-option=-dynamic --ghc-option=-dynload --ghc-option=deploy
endif
.PHONY: default all with-bootstrapping-compiler with-stage-1 clean distclean
.PHONY: default all with-bootstrapping-compiler with-stage-2 clean distclean
default all: with-bootstrapping-compiler
......@@ -34,12 +34,12 @@ with-bootstrapping-compiler:
$(CABAL) build --distpref dist-inplace $(BUILD_FLAGS)
$(CABAL) install --distpref dist-inplace $(INSTALL_FLAGS)
with-stage-1:
with-stage-2:
$(CABAL) configure --distpref dist-install \
$(INSTALL_DIRS_CONFIGURE_FLAGS) \
$(USE_STAGE1_CONFIGURE_FLAGS) \
$(USE_STAGE2_CONFIGURE_FLAGS) \
$(COMMON_CONFIGURE_FLAGS) \
$(EXTRA_STAGE1_CONFIGURE_FLAGS)
$(EXTRA_STAGE2_CONFIGURE_FLAGS)
$(CABAL) build --distpref dist-install $(DYN_FLAGS) $(BUILD_FLAGS)
install:
......
......@@ -52,15 +52,15 @@ endif
WITH_BOOTSTRAPPING_COMPILER = installPackage ghc-pkg hsc2hs hpc
WITH_STAGE1 = installPackage ghc-pkg hasktags runghc hpc pwd haddock
WITH_STAGE2 = installPackage ghc-pkg hasktags runghc hpc pwd haddock
ifneq "$(NO_INSTALL_HSC2HS)" "YES"
WITH_STAGE1 += hsc2hs
WITH_STAGE2 += hsc2hs
endif
# sort removes duplicates - we don't actually care about the order
WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE1))
WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE2))
binary-dist: $(foreach P,$(WITH_STAGE1),binary-dist.$P)
binary-dist: $(foreach P,$(WITH_STAGE2),binary-dist.$P)
ifeq "$(WHERE_AM_I)" ""
echo "I don't know where I am" >&2
exit 1
......@@ -75,9 +75,10 @@ distclean:: $(foreach P,$(WITH_EITHER),distclean.$P)
with-bootstrapping-compiler: \
$(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
with-stage-1: $(foreach P,$(WITH_STAGE1),with-stage-1.$P)
with-stage-2: $(foreach P,$(WITH_STAGE2),with-stage-2.$P)
$(MAKE) -C haddock install-inplace
install:: $(foreach P,$(WITH_STAGE1),install.$P)
install:: $(foreach P,$(WITH_STAGE2),install.$P)
$(foreach P,$(WITH_EITHER),clean.$P): \
clean.%:
......@@ -91,15 +92,15 @@ $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \
with-bootstrapping-compiler.%:
$(MAKE) -C $* with-bootstrapping-compiler
$(foreach P,$(WITH_STAGE1),with-stage-1.$P): \
with-stage-1.%:
$(MAKE) -C $* with-stage-1
$(foreach P,$(WITH_STAGE2),with-stage-2.$P): \
with-stage-2.%:
$(MAKE) -C $* with-stage-2
$(foreach P,$(WITH_STAGE1),install.$P): \
$(foreach P,$(WITH_STAGE2),install.$P): \
install.%:
$(MAKE) -C $* install
$(foreach P,$(WITH_STAGE1),binary-dist.$P): \
$(foreach P,$(WITH_STAGE2),binary-dist.$P): \
binary-dist.%:
$(MAKE) -C $* binary-dist WHERE_AM_I=$(WHERE_AM_I)/$*
......@@ -3,13 +3,13 @@ TOP=../..
ENABLE_SHELL_WRAPPERS = YES
EXTRA_CLEAN = Version.hs
EXTRA_INPLACE_CONFIGURE_FLAGS = $(INPLACE_GHC_DATADIR_CONFIGURE_FLAGS)
EXTRA_STAGE1_CONFIGURE_FLAGS = --datasubdir=.
EXTRA_STAGE2_CONFIGURE_FLAGS = --datasubdir=.
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/cabal.mk
with-bootstrapping-compiler: Version.hs
with-stage-1: Version.hs
with-stage-2: Version.hs
Version.hs: Makefile $(TOP)/mk/config.mk
$(RM) -f Version.hs
......
......@@ -4,6 +4,6 @@ include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/cabal.mk
# We should stop installPackage being installed itself, but we do need
# to build it with the stage1 compiler as we need to use it when
# to build it with the stage2 compiler as we need to use it when
# installing.
......@@ -59,11 +59,13 @@ doInstall verbosity distPref enableShellWrappers strip
do let userHooks = simpleUserHooks
copyto = if null destdir then NoCopyDest else CopyTo destdir
copyFlags = defaultCopyFlags {
copyDistPref = toFlag distPref,
copyUseWrapper = toFlag enableShellWrappers,
copyDest = toFlag copyto,
copyVerbosity = toFlag verbosity
}
registerFlags = defaultRegisterFlags {
regDistPref = toFlag distPref,
regPackageDB = toFlag GlobalPackageDB,
regVerbosity = toFlag verbosity,
regGenScript = toFlag $ False,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment