1##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
2# 
3#                     The LLVM Compiler Infrastructure
4#
5# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
7# 
8##===----------------------------------------------------------------------===##
9
10ifdef 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.
16SRC_DOC_DIR=
17DST_HTML_DIR=html/
18DST_MAN_DIR=man/man1/
19DST_PS_DIR=ps/
20
21# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
22all:: html man ps
23
24clean:
25	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
26
27# To create other directories, as needed, and timestamp their creation
28%/.dir:
29	-mkdir $* > /dev/null
30	date > $@
31
32else
33
34# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
35LEVEL := ../..
36include $(LEVEL)/Makefile.common
37
38SRC_DOC_DIR=$(PROJ_SRC_DIR)/
39DST_HTML_DIR=$(PROJ_OBJ_DIR)/
40DST_MAN_DIR=$(PROJ_OBJ_DIR)/
41DST_PS_DIR=$(PROJ_OBJ_DIR)/
42
43endif
44
45
46POD  := $(wildcard $(SRC_DOC_DIR)*.pod)
47HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
48MAN  := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
49PS   := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
50
51# The set of man pages we will not install
52NO_INSTALL_MANS = $(DST_MAN_DIR)FileCheck.1
53
54# The set of man pages that we will install
55INSTALL_MANS = $(filter-out $(NO_INSTALL_MANS), $(MAN))
56
57.SUFFIXES:
58.SUFFIXES: .html .pod .1 .ps
59
60$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
61	pod2html --css=manpage.css --htmlroot=. \
62	  --podpath=. --noindex --infile=$< --outfile=$@ --title=$*
63
64$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
65	pod2man --release=CVS --center="LLVM Command Guide" $< $@
66
67$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
68	groff -Tps -man $< > $@
69
70
71html: $(HTML)
72man: $(MAN)
73ps: $(PS)
74
75EXTRA_DIST := $(POD) index.html
76
77clean-local::
78	$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
79
80HTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/CommandGuide
81MAN_DIR  := $(DESTDIR)$(PROJ_mandir)/man1
82PS_DIR   := $(DESTDIR)$(PROJ_docsdir)/ps
83
84install-local:: $(HTML) $(INSTALL_MANS) $(PS)
85	$(Echo) Installing HTML CommandGuide Documentation
86	$(Verb) $(MKDIR) $(HTML_DIR)
87	$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
88	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR)
89	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
90	$(Echo) Installing MAN CommandGuide Documentation
91	$(Verb) $(MKDIR) $(MAN_DIR)
92	$(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
93	$(Echo) Installing PS CommandGuide Documentation
94	$(Verb) $(MKDIR) $(PS_DIR)
95	$(Verb) $(DataInstall) $(PS) $(PS_DIR)
96
97uninstall-local::
98	$(Echo) Uninstalling CommandGuide Documentation
99	$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
100
101printvars::
102	$(Echo) "POD            : " '$(POD)'
103	$(Echo) "HTML           : " '$(HTML)'
104