summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-03-01 16:34:33 +0000
committerIan Lynagh <ian@well-typed.com>2013-03-01 21:02:49 +0000
commit104ff6e9ad85751dab2fc2ed25cf8f7827bb13f1 (patch)
tree840b8c87b16818837d142b6034145f4b25dba8d4
parent458c653a795ea06e7cbd24872e9961711f7044e8 (diff)
downloadhaskell-104ff6e9ad85751dab2fc2ed25cf8f7827bb13f1.tar.gz
Change how the build system handles packages
This makes the build system a little simpler, and in particular will make it easier to handle the changes needed for cross-compilation.
-rwxr-xr-xboot5
-rw-r--r--compiler/ghc.mk4
-rw-r--r--ghc.mk261
-rw-r--r--mk/config.mk.in5
-rw-r--r--rules/extra-packages.mk48
-rw-r--r--rules/foreachLibrary.mk43
-rw-r--r--rules/haddock.mk2
7 files changed, 161 insertions, 207 deletions
diff --git a/boot b/boot
index f1282fce0d..13747421ed 100755
--- a/boot
+++ b/boot
@@ -131,8 +131,9 @@ sub boot_pkgs {
or die "Opening $package/ghc.mk failed: $!";
print GHCMK "${package}_PACKAGE = ${pkg}\n";
print GHCMK "${package}_dist-install_GROUP = libraries\n";
- print GHCMK "\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
- print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE2)),2,1)))\n";
+ print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
+ print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE1)),\$(eval \$(call build-package,${package},dist-install,1)))\n";
+ print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE2)),\$(eval \$(call build-package,${package},dist-install,2)))\n";
close GHCMK
or die "Closing $package/ghc.mk failed: $!";
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index fe6779bd01..fc736c80d7 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -409,10 +409,6 @@ compiler_stage1_REGISTER_PACKAGE = NO
endif
-# haddocking only happens for stage2
-compiler_stage1_DO_HADDOCK = NO
-compiler_stage3_DO_HADDOCK = NO
-
# Don't do splitting for the GHC package, it takes too long and
# there's not much benefit.
compiler_stage1_SplitObjs = NO
diff --git a/ghc.mk b/ghc.mk
index c7cd9be868..a4be8c49a6 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -271,7 +271,7 @@ include rules/build-package.mk
include rules/build-package-way.mk
include rules/haddock.mk
include rules/tags-package.mk
-include rules/extra-packages.mk
+include rules/foreachLibrary.mk
# -----------------------------------------------------------------------------
# Registering hand-written package descriptions (used in rts)
@@ -322,138 +322,126 @@ endif
@:
# -----------------------------------------------------------------------------
-# Properties of packages
+# Packages to build
+# The lists of packages that we *actually* going to build in each stage:
+#
+# $(PACKAGES_STAGE0)
+# $(PACKAGES_STAGE1)
+# $(PACKAGES_STAGE2)
+#
+# Note that we need to add them to these variables in dependency
+# order, as this is the order that they get configured in.
-# These lists say "if this package is built, here's a property it has"
-# They do not say "this package will be built"; see $(PACKAGES_STAGExx) for that
+ifeq "$(CLEANING)" "YES"
-# Packages that are built but not installed
-PKGS_THAT_ARE_INTREE_ONLY := haskeline terminfo xhtml
+define addLibraryForCleaning
+# We just add all packages to both the stage 0 and stage 1 lists.
+# Stage 2 gets cleaned in the same way as stage 1, so no need to
+# add it there.
+PACKAGES_STAGE0 += $1
+PACKAGES_STAGE1 += $1
+endef
+$(eval $(call foreachLibrary,addLibraryForCleaning))
-PKGS_THAT_ARE_DPH := \
- dph/dph-base \
- dph/dph-prim-interface dph/dph-prim-seq dph/dph-prim-par \
- dph/dph-lifted-base \
- dph/dph-lifted-boxed dph/dph-lifted-copy dph/dph-lifted-vseg \
- vector primitive random
+else
-# Packages that, if present, must be built by the stage2 compiler,
-# because they use TH and/or annotations, or depend on other stage2
-# packages:
-PKGS_THAT_BUILD_WITH_STAGE2 := $(PKGS_THAT_ARE_DPH)
-ifeq "$(CrossCompiling)" "NO"
-# We cannot use the stage 2 compiler, it runs on $(TARGETPLATFORM)
-PKGS_THAT_BUILD_WITH_STAGE2 += old-time haskell98 haskell2010
+# Packages that are built by stage0. These packages are dependencies of
+# programs such as GHC and ghc-pkg, that we do not assume the stage0
+# compiler already has installed (or up-to-date enough).
+
+PACKAGES_STAGE0 = Cabal/Cabal hpc bin-package-db hoopl transformers
+ifeq "$(Windows)" "NO"
+PACKAGES_STAGE0 += terminfo
endif
-# Packages that we shouldn't build if we don't have TH (e.g. because
-# we're building a profiled compiler):
-PKGS_THAT_USE_TH := $(PKGS_THAT_ARE_DPH)
+PACKAGES_STAGE1 += ghc-prim
+PACKAGES_STAGE1 += $(INTEGER_LIBRARY)
+PACKAGES_STAGE1 += base
+PACKAGES_STAGE1 += filepath
+PACKAGES_STAGE1 += array
+PACKAGES_STAGE1 += deepseq
+PACKAGES_STAGE1 += bytestring
+PACKAGES_STAGE1 += containers
+PACKAGES_STAGE1 += old-locale
-# Packages that are built by stage0, in addition to stage1. These
-# packages are dependencies of GHC, that we do not assume the stage0
-# compiler already has installed (or up-to-date enough).
-#
-# We assume that the stage0 compiler has a suitable bytestring package,
-# so we don't have to include it below.
-PKGS_THAT_BUILD_WITH_STAGE0 = Cabal/Cabal hpc bin-package-db hoopl transformers
+ifeq "$(Windows)" "YES"
+PACKAGES_STAGE1 += Win32
+endif
+PACKAGES_STAGE1 += time
ifeq "$(Windows)" "NO"
-PKGS_THAT_BUILD_WITH_STAGE0 += terminfo
+PACKAGES_STAGE1 += unix
endif
-# $(EXTRA_PACKAGES) is another classification, of packages built but
-# not installed
-# It is set in rules/extra-package.mk,
-# by $(call extra-packages) a little further down
-# this ghc.mk
+PACKAGES_STAGE1 += directory
+PACKAGES_STAGE1 += process
+PACKAGES_STAGE1 += hpc
+PACKAGES_STAGE1 += pretty
+PACKAGES_STAGE1 += template-haskell
+PACKAGES_STAGE1 += Cabal/Cabal
+PACKAGES_STAGE1 += binary
+PACKAGES_STAGE1 += bin-package-db
+PACKAGES_STAGE1 += hoopl
+PACKAGES_STAGE1 += transformers
+ifneq "$(CrossCompiling)" "YES"
+PACKAGES_STAGE2 += old-time
+PACKAGES_STAGE2 += haskell98
+PACKAGES_STAGE2 += haskell2010
+endif
+# We normally install only the packages down to this point
+REGULAR_INSTALL_PACKAGES := $(addprefix libraries/,$(PACKAGES_STAGE1))
+ifeq "$(Stage1Only)" "NO"
+REGULAR_INSTALL_PACKAGES += compiler
+endif
+REGULAR_INSTALL_PACKAGES += $(addprefix libraries/,$(PACKAGES_STAGE2))
-# ----------------------------------------------------------------------------
-# Packages to build
-# The lists of packages that we *actually* going to build in each stage:
-#
-# $(PACKAGES_STAGE0)
-# $(PACKAGES_STAGE1)
-# $(PACKAGES_STAGE2)
-#
-# These are automatically derived from
-# (a) the set of packages in this source tree
-# (b) the predicates above, e.g. $(PKGS_THAT_BUILD_WITH_STAGE2)
-# (c) which platform we're on, and a few other things
-
-
-# no processing to do on this one: it really is the list of packages
-# to build with stage 0.
-PACKAGES_STAGE0 = $(PKGS_THAT_BUILD_WITH_STAGE0)
-
-define addPackageGeneral
-# args: $1 = PACKAGES variable, $2 = package, $3 = condition
- ifeq "$3" ""
- $1 += $2
- else
- ifeq "$$(CLEANING)" "YES"
- $1 += $2
- else
- ifeq $3
- $1 += $2
- endif
- endif
- endif
-endef
+PACKAGES_STAGE1 += xhtml
+ifeq "$(Windows)" "NO"
+PACKAGES_STAGE1 += terminfo
+endif
+PACKAGES_STAGE1 += haskeline
+
+# If we have built the programs with dynamic libraries, then
+# ghc will be dynamically linked against haskeline.so etc, so
+# we need the dynamic libraries of everything down to here
+REGULAR_INSTALL_DYNLIBS := $(addprefix libraries/,$(PACKAGES_STAGE1))
+REGULAR_INSTALL_DYNLIBS += $(addprefix libraries/,$(PACKAGES_STAGE2))
+REGULAR_INSTALL_DYNLIBS := $(filter-out $(REGULAR_INSTALL_PACKAGES),\
+ $(REGULAR_INSTALL_DYNLIBS))
-define addPackage # args: $1 = package, $2 = condition
-ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES"
-ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1"
ifneq "$(CrossCompiling)" "YES"
-$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2)
-endif
+define addExtraPackage
+ifeq "$2" "-"
+# Do nothing; this package is already handled above
+else ifeq "$2 $$(GhcProfiled)" "dph YES"
+# Ignore the package: These packages need TH, which is incompatible
+# with a profiled GHC
else
-$(call addPackageGeneral,PACKAGES_STAGE1,$1,$2)
-endif
+PACKAGES_STAGE2 += $1
endif
endef
+$(eval $(call foreachLibrary,addExtraPackage))
+endif
-# Add all the packages. Note that we need to add them in dependency
-# order, as this is the order that they get configured in.
+# If we want to just install evreything, then we want all the packages
+SUPERSIZE_INSTALL_PACKAGES := $(addprefix libraries/,$(PACKAGES_STAGE1))
+ifeq "$(Stage1Only)" "NO"
+SUPERSIZE_INSTALL_PACKAGES += compiler
+endif
+SUPERSIZE_INSTALL_PACKAGES += $(addprefix libraries/,$(PACKAGES_STAGE2))
-$(eval $(call addPackage,ghc-prim))
-ifeq "$(CLEANING)" "YES"
-$(eval $(call addPackage,integer-gmp))
-$(eval $(call addPackage,integer-simple))
+INSTALL_DYNLIBS :=
+ifeq "$(InstallExtraPackages)" "NO"
+INSTALL_PACKAGES := $(REGULAR_INSTALL_PACKAGES)
+ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
+INSTALL_DYNLIBS := $(REGULAR_INSTALL_DYNLIBS)
+endif
else
-$(eval $(call addPackage,$(INTEGER_LIBRARY)))
-endif
-$(eval $(call addPackage,base))
-$(eval $(call addPackage,filepath))
-$(eval $(call addPackage,array))
-$(eval $(call addPackage,deepseq))
-$(eval $(call addPackage,bytestring))
-$(eval $(call addPackage,containers))
-$(eval $(call addPackage,old-locale))
-$(eval $(call addPackage,old-time))
-
-$(eval $(call addPackage,Win32,($$(Windows),YES)))
-$(eval $(call addPackage,time))
-$(eval $(call addPackage,unix,($$(Windows),NO)))
-
-$(eval $(call addPackage,directory))
-$(eval $(call addPackage,process))
-$(eval $(call addPackage,haskell98))
-$(eval $(call addPackage,haskell2010))
-$(eval $(call addPackage,hpc))
-$(eval $(call addPackage,pretty))
-$(eval $(call addPackage,template-haskell))
-$(eval $(call addPackage,Cabal/Cabal))
-$(eval $(call addPackage,binary))
-$(eval $(call addPackage,bin-package-db))
-$(eval $(call addPackage,hoopl))
-$(eval $(call addPackage,transformers))
-$(eval $(call addPackage,xhtml))
-$(eval $(call addPackage,terminfo,($$(Windows),NO)))
-$(eval $(call addPackage,haskeline))
-
-$(eval $(call extra-packages))
+INSTALL_PACKAGES := $(SUPERSIZE_INSTALL_PACKAGES)
+endif
+
+endif
# -------------------------------------------
# Dependencies between package-data.mk files
@@ -622,9 +610,12 @@ endif
ifneq "$(CLEANING)" "YES"
BUILD_DIRS += \
- $(patsubst %, libraries/%, $(PACKAGES_STAGE1))
+ $(patsubst %, libraries/%, $(PACKAGES_STAGE1)) \
+ $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) \
+ libraries/dph
endif
+
ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
BUILD_DIRS += libraries/integer-gmp/gmp
else ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
@@ -666,22 +657,10 @@ endif
BUILD_DIRS += utils/count_lines
BUILD_DIRS += utils/compare_sizes
-ifneq "$(CLEANING)" "YES"
-# After compiler/, because these packages depend on it
-BUILD_DIRS += \
- $(patsubst %, libraries/%, $(PACKAGES_STAGE2))
-endif
-
# ----------------------------------------------
# Actually include all the sub-ghc.mk's
-# BUILD_DIRS_EXTRA needs to come after BUILD_DIRS, because stuff in
-# libraries/dph/ghc.mk refers to stuff defined earlier, in particular
-# things like $(libraries/dph/dph-base_dist-install_GHCI_LIB)
-ifeq "$(GhcProfiled)" "YES"
-BUILD_DIRS_EXTRA := $(filter-out libraries/dph,$(BUILD_DIRS_EXTRA))
-endif
-include $(patsubst %, %/ghc.mk, $(BUILD_DIRS) $(BUILD_DIRS_EXTRA))
+include $(patsubst %, %/ghc.mk, $(BUILD_DIRS))
# A useful pseudo-target (must be after the include above, because it needs
# the value of things like $(libraries/base_dist-install_v_LIB).
@@ -706,10 +685,10 @@ $(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$
# -----------------------------------------------
# Haddock-related bits
-# Don't run Haddock for the package that will not be installed
-$(foreach p,$(PKGS_THAT_ARE_INTREE_ONLY),$(eval libraries/$p_dist-install_DO_HADDOCK = NO))
-# We don't haddock the bootstrapping libraries
-$(foreach p,$(PACKAGES_STAGE0),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO))
+# Run Haddock for the packages that will be installed. We need to handle
+# compiler specially due to the different dist directory name.
+$(foreach p,$(INSTALL_PACKAGES),$(eval $p_dist-install_DO_HADDOCK = YES))
+compiler_stage2_DO_HADDOCK = YES
# Build the Haddock contents and index
ifeq "$(HADDOCK_DOCS)" "YES"
@@ -899,20 +878,8 @@ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
endif
-INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1))
-ifeq "$(Stage1Only)" "NO"
-INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) compiler
-endif
-INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) $(addprefix libraries/,$(PACKAGES_STAGE2))
-ifeq "$(InstallExtraPackages)" "NO"
-INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(EXTRA_PACKAGES)),\
- $(INSTALLED_PKG_DIRS))
-endif
-INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(PKGS_THAT_ARE_INTREE_ONLY)),\
- $(INSTALLED_PKG_DIRS))
-
# Set the INSTALL_DISTDIR_p for each package; compiler is special
-$(foreach p,$(filter-out compiler,$(INSTALLED_PKG_DIRS)),\
+$(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\
$(eval INSTALL_DISTDIR_$p = dist-install))
INSTALL_DISTDIR_compiler = stage2
@@ -924,11 +891,9 @@ install_packages: rts/package.conf.install
$(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)/rts-1.0")
$(call installLibsTo, $(RTS_INSTALL_LIBS), "$(DESTDIR)$(topdir)/rts-1.0")
-ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
- $(foreach p, $(PKGS_THAT_ARE_INTREE_ONLY), \
+ $(foreach p, $(INSTALL_DYNLIBS), \
$(call installLibsTo, $(wildcard libraries/$p/dist-install/build/*.so libraries/$p/dist-install/build/*.dll libraries/$p/dist-install/build/*.dylib), "$(DESTDIR)$(topdir)/$p-$(libraries/$p_dist-install_VERSION)"))
-endif
- $(foreach p, $(INSTALLED_PKG_DIRS), \
+ $(foreach p, $(INSTALL_PACKAGES), \
$(call make-command, \
"$(GHC_CABAL_INPLACE)" copy \
"$(STRIP_CMD)" \
@@ -938,7 +903,7 @@ endif
'$(ghclibdir)' \
'$(docdir)/html/libraries'))
"$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
- $(foreach p, $(INSTALLED_PKG_DIRS), \
+ $(foreach p, $(INSTALL_PACKAGES), \
$(call make-command, \
"$(GHC_CABAL_INPLACE)" register \
"$(INSTALLED_GHC_REAL)" \
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 4831a7c34f..bfc811cb9d 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -315,10 +315,7 @@ SplitObjs=$(SupportsSplitObjs)
# ----------------------------------------------------------------------------
# Package-related things
-# Extra packages to add to the build, in dependency order
-EXTRA_PACKAGES =
-
-# Whether to install $(EXTRA_PACKAGES)
+# Whether to install the extra packages
InstallExtraPackages = NO
# Run "ghc-pkg check" on each package
diff --git a/rules/extra-packages.mk b/rules/extra-packages.mk
deleted file mode 100644
index 98868b45db..0000000000
--- a/rules/extra-packages.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# -----------------------------------------------------------------------------
-#
-# (c) 2010 The University of Glasgow
-#
-# This file is part of the GHC build system.
-#
-# To understand how the build system works and how to modify it, see
-# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
-# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
-#
-# -----------------------------------------------------------------------------
-
-# For each package P marked as "dph" or "extra" in $(TOP)/packages:
-# if $(TOP)/libraries/P exists, then
-# if $(TOP)/libraries/P/ghc-packages exists, then
-# * add each package from $(TOP)/libraries/P/ghc-packages2 to the list of
-# packages.
-# Note: ghc-packages2 might have a different list from
-# ghc-packages, this is to support dph which has some
-# packages that are automatically derived from a single
-# source by the build system).
-# * add $(TOP)/libraries/P to $(BUILD_DIRS)
-# This step is necessary in the case of dph, which has some
-# build system code in libraries/dph/ghc.mk, but
-# libraries/dph is not itself a package.
-# else
-# add P to the list of packages
-
-define extra-packages
-
-# Collects some dirs containing ghc.mk files that we need to include:
-BUILD_DIRS_EXTRA=
-
-$$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ #][^ ]* \+\(dph\|extra\) \+[^ ]\+ \+[^ ]\+$$$$' packages | sed 's/ .*//'))),\
- $$(if $$(wildcard libraries/$$p/ghc-packages),\
- $$(eval BUILD_DIRS_EXTRA += libraries/$$p) \
- $$(foreach q,$$(shell cat libraries/$$p/ghc-packages2),$$(eval $$(call extra-package,$$p,$$p/$$q))),\
- $$(eval $$(call extra-package,$$p,$$p)))\
-)
-endef
-
-define extra-package # $1 = package root, $2 = package
-$(call trace, extra-package($1,$2))
-
-EXTRA_PACKAGES += $2
-$$(eval $$(call addPackage,$2))
-
-endef
diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk
new file mode 100644
index 0000000000..6bf7673336
--- /dev/null
+++ b/rules/foreachLibrary.mk
@@ -0,0 +1,43 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2010 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+# For each line in $(TOP)/packages:
+# libraries/foo tag ...
+# this calls
+# $(call $1,foo,tag)
+#
+# Except! If there's a libraries/foo/ghc-packages then it calls
+# $(call $1,foo/bar,tag)
+# for each word 'bar' in libraries/foo/ghc-packages.
+#
+
+# We use an FEL_ prefix for the variable names, to avoid trampling on
+# other variables, as make has no concept of local variables.
+
+# We need to handle bin-package-db specially, as it doesn't have an
+# entry in the packages file, as it isn't in its own repository.
+
+define foreachLibrary
+# $1 = function to call for each library
+# We will give it the package path and the tag as arguments
+$$(foreach hashline,libraries/bin-package-db#-#no-remote-repo#no-vcs \
+ $$(shell grep '^libraries/' packages | sed 's/ */#/g'),\
+ $$(eval FEL_line := $$(subst #,$$(space),$$(hashline))) \
+ $$(eval FEL_libdir := $$(word 1,$$(FEL_line))) \
+ $$(eval FEL_tag := $$(word 2,$$(FEL_line))) \
+ $$(eval FEL_libroot := $$(patsubst libraries/%,%,$$(FEL_libdir))) \
+ $$(if $$(wildcard $$(FEL_libdir)/ghc-packages), \
+ $$(foreach lib,$$(shell cat $$(FEL_libdir)/ghc-packages), \
+ $$(eval $$(call $1,$$(FEL_libroot)/$$(lib),$$(FEL_tag)))), \
+ $$(if $$(wildcard $$(FEL_libdir)/), \
+ $$(eval $$(call $1,$$(FEL_libroot),$$(FEL_tag))))))
+endef
diff --git a/rules/haddock.mk b/rules/haddock.mk
index 3a3fed4503..99a93f125d 100644
--- a/rules/haddock.mk
+++ b/rules/haddock.mk
@@ -15,7 +15,7 @@ define haddock # args: $1 = dir, $2 = distdir
$(call trace, haddock($1,$2))
$(call profStart, haddock($1,$2))
-ifneq "$$($1_$2_DO_HADDOCK)" "NO"
+ifeq "$$($1_$2_DO_HADDOCK)" "YES"
ifeq "$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE)" ""
$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock