Clean the generated userguide sources
[ghc-hetmet.git] / docs / users_guide / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
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
10 #
11 # -----------------------------------------------------------------------------
12
13 docs/users_guide_GENERATED_DOCBOOK_SOURCES := \
14         docs/users_guide/what_glasgow_exts_does.gen.xml
15
16 # sort remove duplicates
17 docs/users_guide_DOCBOOK_SOURCES :=                           \
18     $(sort $(docs/users_guide_GENERATED_DOCBOOK_SOURCES)      \
19            $(wildcard docs/users_guide/*.xml)                 \
20            $(basename $(wildcard docs/users_guide/*.xml.in)))
21
22 $(docs/users_guide_GENERATED_DOCBOOK_SOURCES): %.gen.xml: inplace/bin/mkUserGuidePart
23         inplace/bin/mkUserGuidePart $@
24
25 $(eval $(call docbook,docs/users_guide,users_guide))
26
27 $(eval $(call clean-target,docs/users_guide,gen,$(docs/users_guide_GENERATED_DOCBOOK_SOURCES)))
28
29 # Hack: dblatex normalises the name of the input file using
30 # os.path.realpath, which means that if we're in a linked build tree,
31 # it won't be able to find ug-book.xml which is in the build tree but
32 # not in the source tree.  Hence, we copy ug-book.xml to the source
33 # tree.  This is a horrible hack, but I can't find a better way to do
34 # it --SDM (2009-05-11)
35
36 build_ug_book = docs/users_guide/ug-book.xml
37 src_ug_book  = $(dir $(realpath $(dir $(build_ug_book))/ug-book.xml.in))ug-book.xml
38
39 # ... and similarly for ug-ent.xml, which is now generated by configure from
40 # ug-ent.xml.in --SDM (2010-02-25)
41
42 build_ug_ent = docs/users_guide/ug-ent.xml
43 src_ug_ent  = $(dir $(realpath $(dir $(build_ug_ent))/ug-ent.xml.in))ug-ent.xml
44
45 html_docs/users_guide : docs/users_guide/users_guide/prof_scc.png
46
47 docs/users_guide/users_guide/prof_scc.png : \
48                 docs/users_guide/prof_scc.png \
49                 docs/users_guide/users_guide/index.html
50         $(CP) $< $@
51 # dep. on d/u/u/index.html is to make sure that the d/u/u dir is created first
52
53 ifneq "$(build_ug_book)" "$(src_ug_book)"
54 $(src_ug_book) : $(build_ug_book)
55         "$(CP)" $< $@
56 ifneq "$(BINDIST)" "YES"
57 docs/users_guide/users_guide.pdf docs/users_guide/users_guide.ps: $(src_ug_book)
58 endif
59 endif
60
61 ifneq "$(build_ug_ent)" "$(src_ug_ent)"
62 $(src_ug_ent) : $(build_ug_ent)
63         "$(CP)" $< $@
64 ifneq "$(BINDIST)" "YES"
65 docs/users_guide/users_guide.pdf docs/users_guide/users_guide.ps: $(src_ug_ent)
66 endif
67 endif
68