blob: 3b65183107263a6eba58aad42d5680996eb82234 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
2#
3# The LLVM Compiler Infrastructure
4#
Chris Lattner3876aa72007-12-29 20:11:13 +00005# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007#
8##===----------------------------------------------------------------------===##
9
10ifdef BUILD_FOR_WEBSITE
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011# 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.
Chris Lattner10a39792008-02-12 06:07:47 +000016SRC_DOC_DIR=
17DST_HTML_DIR=html/
18DST_MAN_DIR=man/man1/
19DST_PS_DIR=ps/
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020
Chris Lattner10a39792008-02-12 06:07:47 +000021# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
22all:: html man ps
Dan Gohmanf17a25c2007-07-18 16:29:46 +000023
24clean:
25 rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
Tanya Lattner00c61912008-06-09 07:14:31 +000026
27# To create other directories, as needed, and timestamp their creation
28%/.dir:
29 -mkdir $* > /dev/null
30 date > $@
31
Chris Lattner10a39792008-02-12 06:07:47 +000032else
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033
Chris Lattner10a39792008-02-12 06:07:47 +000034# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
Dan Gohmanf17a25c2007-07-18 16:29:46 +000035LEVEL := ../..
Dan Gohmanf17a25c2007-07-18 16:29:46 +000036include $(LEVEL)/Makefile.common
37
Chris Lattner10a39792008-02-12 06:07:47 +000038SRC_DOC_DIR=$(PROJ_SRC_DIR)/
39DST_HTML_DIR=$(PROJ_OBJ_DIR)/
40DST_MAN_DIR=$(PROJ_OBJ_DIR)/
41DST_PS_DIR=$(PROJ_OBJ_DIR)/
Dan Gohmanf17a25c2007-07-18 16:29:46 +000042
Chris Lattner10a39792008-02-12 06:07:47 +000043endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +000044
Chris Lattner10a39792008-02-12 06:07:47 +000045
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))
Dan Gohmanf17a25c2007-07-18 16:29:46 +000050
Douglas Gregor87877322009-08-23 05:24:49 +000051# 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
Dan Gohmanf17a25c2007-07-18 16:29:46 +000057.SUFFIXES:
58.SUFFIXES: .html .pod .1 .ps
59
Chris Lattner10a39792008-02-12 06:07:47 +000060$(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
Dan Gohmanf17a25c2007-07-18 16:29:46 +000070
71html: $(HTML)
Chris Lattner10a39792008-02-12 06:07:47 +000072man: $(MAN)
73ps: $(PS)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000074
Chris Lattner10a39792008-02-12 06:07:47 +000075EXTRA_DIST := $(POD) index.html
Dan Gohmanf17a25c2007-07-18 16:29:46 +000076
77clean-local::
78 $(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
79
80HTML_DIR := $(PROJ_docsdir)/html/CommandGuide
81MAN_DIR := $(PROJ_mandir)/man1
82PS_DIR := $(PROJ_docsdir)/ps
83
Douglas Gregor87877322009-08-23 05:24:49 +000084install-local:: $(HTML) $(INSTALL_MANS) $(PS)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000085 $(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)
Douglas Gregor87877322009-08-23 05:24:49 +000092 $(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000093 $(Echo) Installing PS CommandGuide Documentation
94 $(Verb) $(MKDIR) $(PS_DIR)
95 $(Verb) $(DataInstall) $(PS) $(PS_DIR)
96
97uninstall-local::
Erick Tryzelaar5f49cb22008-03-30 20:32:18 +000098 $(Echo) Uninstalling CommandGuide Documentation
99 $(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000100
101printvars::
102 $(Echo) "POD : " '$(POD)'
103 $(Echo) "HTML : " '$(HTML)'