Makefile revision 643698c97594ea1d722e76aea7dcd56ed84bd641
1##===- docs/tools/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
12# FIXME: This was copied from the CommandGuide makefile. Figure out
13# how to get this stuff on the website.
14
15# This special case is for keeping the CommandGuide on the LLVM web site
16# up to date automatically as the documents are checked in. It must build
17# the POD files to HTML only and keep them in the src directories. It must also
18# build in an unconfigured tree, hence the ifdef. To use this, run
19# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
20SRC_DOC_DIR=
21DST_HTML_DIR=html/
22DST_MAN_DIR=man/man1/
23DST_PS_DIR=ps/
24
25# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
26all:: html man ps
27
28clean:
29	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
30
31# To create other directories, as needed, and timestamp their creation
32%/.dir:
33	-mkdir $* > /dev/null
34	date > $@
35
36else
37
38# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
39LEVEL := ../../../..
40include $(LEVEL)/Makefile.common
41
42SRC_DOC_DIR=$(PROJ_SRC_DIR)/
43DST_HTML_DIR=$(PROJ_OBJ_DIR)/
44DST_MAN_DIR=$(PROJ_OBJ_DIR)/
45DST_PS_DIR=$(PROJ_OBJ_DIR)/
46
47endif
48
49
50POD  := $(wildcard $(SRC_DOC_DIR)*.pod)
51HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
52MAN  := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
53PS   := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
54
55ifdef ONLY_MAN_DOCS
56INSTALL_TARGETS := install-man
57else
58INSTALL_TARGETS := install-html install-man install-ps
59endif
60
61.SUFFIXES:
62.SUFFIXES: .html .pod .1 .ps
63
64$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
65	pod2html --css=manpage.css --htmlroot=. \
66	  --podpath=. --infile=$< --outfile=$@ --title=$*
67
68$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
69	pod2man --release "clang 1.0" --center="Clang Tools Documentation" $< $@
70
71$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
72	groff -Tps -man $< > $@
73
74
75html: $(HTML)
76man: $(MAN)
77ps: $(PS)
78
79EXTRA_DIST := $(POD)
80
81clean-local::
82	$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
83
84HTML_DIR := $(PROJ_docsdir)/html/clang
85MAN_DIR  := $(PROJ_mandir)/man1
86PS_DIR   := $(PROJ_docsdir)/ps
87
88install-html:: $(HTML)
89	$(Echo) Installing HTML Clang Tools Documentation
90	$(Verb) $(MKDIR) $(HTML_DIR)
91	$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
92	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
93
94install-man:: $(MAN)
95	$(Echo) Installing MAN Clang Tools Documentation
96	$(Verb) $(MKDIR) $(MAN_DIR)
97	$(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
98
99install-ps:: $(PS)
100	$(Echo) Installing PS Clang Tools Documentation
101	$(Verb) $(MKDIR) $(PS_DIR)
102	$(Verb) $(DataInstall) $(PS) $(PS_DIR)
103
104install-local:: $(INSTALL_TARGETS)
105
106uninstall-local::
107	$(Echo) Uninstalling Clang Tools Documentation
108	$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
109
110printvars::
111	$(Echo) "POD            : " '$(POD)'
112	$(Echo) "HTML           : " '$(HTML)'
113