xref: /minix3/external/bsd/llvm/dist/clang/docs/tools/Makefile (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc##===- docs/tools/Makefile ---------------------------------*- Makefile -*-===##
2*f4a2713aSLionel Sambuc#
3*f4a2713aSLionel Sambuc#                     The LLVM Compiler Infrastructure
4*f4a2713aSLionel Sambuc#
5*f4a2713aSLionel Sambuc# This file is distributed under the University of Illinois Open Source
6*f4a2713aSLionel Sambuc# License. See LICENSE.TXT for details.
7*f4a2713aSLionel Sambuc#
8*f4a2713aSLionel Sambuc##===----------------------------------------------------------------------===##
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambucifdef BUILD_FOR_WEBSITE
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc# FIXME: This was copied from the CommandGuide makefile. Figure out
13*f4a2713aSLionel Sambuc# how to get this stuff on the website.
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc# This special case is for keeping the CommandGuide on the LLVM web site
16*f4a2713aSLionel Sambuc# up to date automatically as the documents are checked in. It must build
17*f4a2713aSLionel Sambuc# the POD files to HTML only and keep them in the src directories. It must also
18*f4a2713aSLionel Sambuc# build in an unconfigured tree, hence the ifdef. To use this, run
19*f4a2713aSLionel Sambuc# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
20*f4a2713aSLionel SambucSRC_DOC_DIR=
21*f4a2713aSLionel SambucDST_HTML_DIR=html/
22*f4a2713aSLionel SambucDST_MAN_DIR=man/man1/
23*f4a2713aSLionel SambucDST_PS_DIR=ps/
24*f4a2713aSLionel SambucCLANG_VERSION := trunk
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
27*f4a2713aSLionel Sambucall:: html man ps
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambucclean:
30*f4a2713aSLionel Sambuc	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambuc# To create other directories, as needed, and timestamp their creation
33*f4a2713aSLionel Sambuc%/.dir:
34*f4a2713aSLionel Sambuc	-mkdir $* > /dev/null
35*f4a2713aSLionel Sambuc	date > $@
36*f4a2713aSLionel Sambuc
37*f4a2713aSLionel Sambucelse
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
40*f4a2713aSLionel SambucCLANG_LEVEL := ../..
41*f4a2713aSLionel Sambucinclude $(CLANG_LEVEL)/Makefile
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel SambucCLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \
44*f4a2713aSLionel Sambuc	$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc))
45*f4a2713aSLionel Sambuc
46*f4a2713aSLionel SambucSRC_DOC_DIR=$(PROJ_SRC_DIR)/
47*f4a2713aSLionel SambucDST_HTML_DIR=$(PROJ_OBJ_DIR)/
48*f4a2713aSLionel SambucDST_MAN_DIR=$(PROJ_OBJ_DIR)/
49*f4a2713aSLionel SambucDST_PS_DIR=$(PROJ_OBJ_DIR)/
50*f4a2713aSLionel Sambuc
51*f4a2713aSLionel Sambucendif
52*f4a2713aSLionel Sambuc
53*f4a2713aSLionel Sambuc
54*f4a2713aSLionel SambucPOD  := $(wildcard $(SRC_DOC_DIR)*.pod)
55*f4a2713aSLionel SambucHTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
56*f4a2713aSLionel SambucMAN  := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
57*f4a2713aSLionel SambucPS   := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambucifdef ONLY_MAN_DOCS
60*f4a2713aSLionel SambucINSTALL_TARGETS := install-man
61*f4a2713aSLionel Sambucelse
62*f4a2713aSLionel SambucINSTALL_TARGETS := install-html install-man install-ps
63*f4a2713aSLionel Sambucendif
64*f4a2713aSLionel Sambuc
65*f4a2713aSLionel Sambuc.SUFFIXES:
66*f4a2713aSLionel Sambuc.SUFFIXES: .html .pod .1 .ps
67*f4a2713aSLionel Sambuc
68*f4a2713aSLionel Sambuc$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
69*f4a2713aSLionel Sambuc	pod2html --css=manpage.css --htmlroot=. \
70*f4a2713aSLionel Sambuc	  --podpath=. --infile=$< --outfile=$@ --title=$*
71*f4a2713aSLionel Sambuc
72*f4a2713aSLionel Sambuc$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
73*f4a2713aSLionel Sambuc	pod2man --release "clang $(CLANG_VERSION)" --center="Clang Tools Documentation" $< $@
74*f4a2713aSLionel Sambuc
75*f4a2713aSLionel Sambuc$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
76*f4a2713aSLionel Sambuc	groff -Tps -man $< > $@
77*f4a2713aSLionel Sambuc
78*f4a2713aSLionel Sambuc
79*f4a2713aSLionel Sambuchtml: $(HTML)
80*f4a2713aSLionel Sambucman: $(MAN)
81*f4a2713aSLionel Sambucps: $(PS)
82*f4a2713aSLionel Sambuc
83*f4a2713aSLionel SambucEXTRA_DIST := $(POD)
84*f4a2713aSLionel Sambuc
85*f4a2713aSLionel Sambucclean-local::
86*f4a2713aSLionel Sambuc	$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
87*f4a2713aSLionel Sambuc
88*f4a2713aSLionel SambucHTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/clang
89*f4a2713aSLionel SambucMAN_DIR  := $(DESTDIR)$(PROJ_mandir)/man1
90*f4a2713aSLionel SambucPS_DIR   := $(DESTDIR)$(PROJ_docsdir)/ps
91*f4a2713aSLionel Sambuc
92*f4a2713aSLionel Sambucinstall-html:: $(HTML)
93*f4a2713aSLionel Sambuc	$(Echo) Installing HTML Clang Tools Documentation
94*f4a2713aSLionel Sambuc	$(Verb) $(MKDIR) $(HTML_DIR)
95*f4a2713aSLionel Sambuc	$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
96*f4a2713aSLionel Sambuc	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
97*f4a2713aSLionel Sambuc
98*f4a2713aSLionel Sambucinstall-man:: $(MAN)
99*f4a2713aSLionel Sambuc	$(Echo) Installing MAN Clang Tools Documentation
100*f4a2713aSLionel Sambuc	$(Verb) $(MKDIR) $(MAN_DIR)
101*f4a2713aSLionel Sambuc	$(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
102*f4a2713aSLionel Sambuc
103*f4a2713aSLionel Sambucinstall-ps:: $(PS)
104*f4a2713aSLionel Sambuc	$(Echo) Installing PS Clang Tools Documentation
105*f4a2713aSLionel Sambuc	$(Verb) $(MKDIR) $(PS_DIR)
106*f4a2713aSLionel Sambuc	$(Verb) $(DataInstall) $(PS) $(PS_DIR)
107*f4a2713aSLionel Sambuc
108*f4a2713aSLionel Sambucinstall-local:: $(INSTALL_TARGETS)
109*f4a2713aSLionel Sambuc
110*f4a2713aSLionel Sambucuninstall-local::
111*f4a2713aSLionel Sambuc	$(Echo) Uninstalling Clang Tools Documentation
112*f4a2713aSLionel Sambuc	$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
113*f4a2713aSLionel Sambuc
114*f4a2713aSLionel Sambucprintvars::
115*f4a2713aSLionel Sambuc	$(Echo) "POD            : " '$(POD)'
116*f4a2713aSLionel Sambuc	$(Echo) "HTML           : " '$(HTML)'
117