summaryrefslogtreecommitdiff
path: root/rules/haddock.mk
blob: 8c5f00ac4c132d3b56f12cfd9ee2c5ddb21410b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -----------------------------------------------------------------------------
#
# (c) 2009 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
#
# -----------------------------------------------------------------------------


define haddock  # args: $1 = dir,  $2 = distdir, $3 = way

ifneq "$$($1_$2_DO_HADDOCK)" "NO"

ifeq "$$($$($1_PACKAGE)_HADDOCK_FILE)" ""
$$($1_PACKAGE)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock
else
$$(error Already got a haddock file for $$($1_PACKAGE))
endif

ifeq "HADDOCK_DOCS" "YES"
$(call all-target,$1_$2_haddock,$$($$($1_PACKAGE)_HADDOCK_FILE))
endif

$$($1_PACKAGE)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEP_NAMES),$$($$n_HADDOCK_FILE))

ifeq "$$(HSCOLOUR_SRCS)" "YES"
$1_$2_HADDOCK_FLAGS += --hyperlink-source
endif

$$($$($1_PACKAGE)_HADDOCK_FILE) : $$(MKDIRHIER) $(INPLACE_BIN)/haddock$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)_HADDOCK_DEPS)
	$$(MKDIRHIER) $$(dir $$@)
	$$(GHC_CABAL_INPLACE) haddock $2 $1 --with-haddock=$$(TOP)/$(INPLACE_BIN)/haddock --with-ghc=$$(TOP)/$(INPLACE_BIN)/ghc-stage2 $$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS)

endif

endef