1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
7 # To understand how the build system works and how to modify it, see
8 # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
11 # -----------------------------------------------------------------------------
14 define haddock # args: $1 = dir, $2 = distdir
16 ifneq "$$($1_$2_DO_HADDOCK)" "NO"
18 ifeq "$$($$($1_PACKAGE)_HADDOCK_FILE)" ""
19 $$($1_PACKAGE)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock
21 $$(error Already got a haddock file for $$($1_PACKAGE))
24 haddock: $$($$($1_PACKAGE)_HADDOCK_FILE)
26 ifeq "$$(HADDOCK_DOCS)" "YES"
27 $(call all-target,$1_$2_haddock,$$($$($1_PACKAGE)_HADDOCK_FILE))
30 $$($1_PACKAGE)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEP_NAMES),$$($$n_HADDOCK_FILE))
32 ifeq "$$(HSCOLOUR_SRCS)" "YES"
33 $1_$2_HADDOCK_FLAGS += --hyperlink-source
36 $$($$($1_PACKAGE)_HADDOCK_FILE) : $$(MKDIRHIER) $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)_HADDOCK_DEPS)
37 "$$(MKDIRHIER)" $$(dir $$@)
38 "$$(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)
40 # Make the haddocking depend on the library .a file, to ensure
41 # that we wait until the library is fully build before we haddock it
42 $$($$($1_PACKAGE)_HADDOCK_FILE) : $$($1_$2_v_LIB)