blob: 90eb7768f531b16f34203506d3c92026f2fe41dd [file] [log] [blame]
Daniel Dunbardbec0332009-04-29 01:00:32 +00001##===- 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
Daniel Dunbare0a80922009-05-01 23:11:42 +000055ifdef ONLY_MAN_DOCS
56INSTALL_TARGETS := install-man
57else
58INSTALL_TARGETS := install-html install-man install-ps
59endif
60
Daniel Dunbardbec0332009-04-29 01:00:32 +000061.SUFFIXES:
62.SUFFIXES: .html .pod .1 .ps
63
64$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
65 pod2html --css=manpage.css --htmlroot=. \
Chris Lattner482c6822009-05-11 22:45:37 +000066 --podpath=. --infile=$< --outfile=$@ --title=$*
Daniel Dunbardbec0332009-04-29 01:00:32 +000067
68$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
Daniel Dunbara3c078e2009-05-06 00:10:37 +000069 pod2man --release "clang 1.0" --center="Clang Tools Documentation" $< $@
Daniel Dunbardbec0332009-04-29 01:00:32 +000070
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
Daniel Dunbar632975b2009-05-01 23:34:58 +000088install-html:: $(HTML)
Daniel Dunbardbec0332009-04-29 01:00:32 +000089 $(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)
Daniel Dunbare0a80922009-05-01 23:11:42 +000093
Daniel Dunbar632975b2009-05-01 23:34:58 +000094install-man:: $(MAN)
Daniel Dunbardbec0332009-04-29 01:00:32 +000095 $(Echo) Installing MAN Clang Tools Documentation
96 $(Verb) $(MKDIR) $(MAN_DIR)
97 $(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
Daniel Dunbare0a80922009-05-01 23:11:42 +000098
Daniel Dunbar632975b2009-05-01 23:34:58 +000099install-ps:: $(PS)
Daniel Dunbardbec0332009-04-29 01:00:32 +0000100 $(Echo) Installing PS Clang Tools Documentation
101 $(Verb) $(MKDIR) $(PS_DIR)
102 $(Verb) $(DataInstall) $(PS) $(PS_DIR)
103
Daniel Dunbare0a80922009-05-01 23:11:42 +0000104install-local:: $(INSTALL_TARGETS)
105
Daniel Dunbardbec0332009-04-29 01:00:32 +0000106uninstall-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)'