Make an alternate version of this Makefile that can be used in an
[oota-llvm.git] / docs / CommandGuide / Makefile
1 ##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
2
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
7
8 ##===----------------------------------------------------------------------===##
9
10 ifdef BUILD_FOR_WEBSITE
11 # This special case is for keeping the CommandGuide on the LLVM web site
12 # up to date automatically as the documents are checked in. It must build
13 # the POD files to HTML only and keep them in the src directories. It must also
14 # build in an unconfigured tree, hence the ifdef. To use this, run
15 # make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
16
17 POD  := $(wildcard *.pod)
18 HTML := $(patsubst %.pod,html/%.html, $(POD))
19
20 all: $(HTML)
21
22 html/%.html : %.pod
23         pod2html --css=manpage.css --htmlroot=. --podpath=. \
24           --noindex --infile=$< --outfile=$@ --title=$*
25
26 else 
27
28 LEVEL := ../..
29
30 include $(LEVEL)/Makefile.common
31
32 POD := $(wildcard $(BUILD_SRC_DIR)/*.pod)
33
34 EXTRA_DIST := $(POD) index.html
35
36 HTML = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.html, $(POD))
37 MAN = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.1, $(POD))
38 PS = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.ps, $(POD))
39
40 .SUFFIXES:
41 .SUFFIXES: .html .pod .1 .ps
42
43 $(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir
44
45 $(BUILD_OBJ_DIR)/%.html: %.pod
46         $(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \
47           --noindex --infile=$< --outfile=$@ --title=$*
48
49 $(BUILD_OBJ_DIR)/%.1: %.pod
50         $(POD2MAN) --release=$(PACKAGE_VERSION) \
51           --center="LLVM Command Guide" $< $@
52
53 $(BUILD_OBJ_DIR)/%.ps: $(BUILD_OBJ_DIR)/%.1
54         $(GROFF) -Tps -man $< > $@
55
56 clean-local::
57         $(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
58
59 HTML_DIR := $(LLVM_DOCSDIR)/html/CommandGuide
60 MAN_DIR  := $(LLVM_MANDIR)/man1
61 PS_DIR   := $(LLVM_DOCSDIR)/ps
62
63 install-local:: $(HTML) $(MAN) $(PS)
64         $(Echo) Installing HTML CommandGuide Documentation
65         $(Verb) $(INSTALL) -d $(HTML_DIR)
66         $(Verb) $(INSTALL) -C $(HTML) $(HTML_DIR)
67         $(Verb) $(INSTALL) -C $(BUILD_SRC_DIR)/index.html $(HTML_DIR)
68         $(Verb) $(INSTALL) -C $(BUILD_SRC_DIR)/manpage.css $(HTML_DIR)
69         $(Echo) Installing MAN CommandGuide Documentation
70         $(Verb) $(INSTALL) -d $(MAN_DIR)
71         $(Verb) $(INSTALL) -C $(MAN) $(MAN_DIR)
72         $(Echo) Installing PS CommandGuide Documentation
73         $(Verb) $(INSTALL) -d $(PS_DIR)
74         $(Verb) $(INSTALL) -C $(PS) $(PS_DIR)
75
76 uninstall-local::
77         $(Echo) Uninstalling Documentation
78         $(Verb) $(RM) -rf $(LLVM_DOCSDIR)
79
80 printvars::
81         $(Echo) "POD            : " '$(POD)'
82         $(Echo) "HTML           : " '$(HTML)'
83
84 endif