haddock.mk 1.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
# -----------------------------------------------------------------------------
#
# (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
#
# -----------------------------------------------------------------------------

Ian Lynagh's avatar
Ian Lynagh committed
13

Simon Marlow's avatar
Simon Marlow committed
14
define haddock  # args: $1 = dir,  $2 = distdir
Ian Lynagh's avatar
Ian Lynagh committed
15 16 17 18 19 20 21 22 23

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

24 25
haddock: $$($$($1_PACKAGE)_HADDOCK_FILE)

Ian Lynagh's avatar
Ian Lynagh committed
26
ifeq "$$(HADDOCK_DOCS)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
27
$(call all-target,$1_$2_haddock,$$($$($1_PACKAGE)_HADDOCK_FILE))
28
endif
Ian Lynagh's avatar
Ian Lynagh committed
29 30 31 32 33 34 35

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

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

36
$$($$($1_PACKAGE)_HADDOCK_FILE) : $$(MKDIRHIER) $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)_HADDOCK_DEPS)
37 38
	"$$(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)
Ian Lynagh's avatar
Ian Lynagh committed
39

40 41 42 43
# Make the haddocking depend on the library .a file, to ensure
# that we wait until the library is fully build before we haddock it
$$($$($1_PACKAGE)_HADDOCK_FILE) : $$($1_$2_v_LIB)

Ian Lynagh's avatar
Ian Lynagh committed
44 45 46 47
endif

endef