mike-m | 3e5d00c | 2010-05-07 00:42:33 +0000 | [diff] [blame^] | 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 | |
| 10 | ifdef 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. |
| 20 | SRC_DOC_DIR= |
| 21 | DST_HTML_DIR=html/ |
| 22 | DST_MAN_DIR=man/man1/ |
| 23 | DST_PS_DIR=ps/ |
| 24 | CLANG_VERSION := trunk |
| 25 | |
| 26 | # If we are in BUILD_FOR_WEBSITE mode, default to the all target. |
| 27 | all:: html man ps |
| 28 | |
| 29 | clean: |
| 30 | rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) |
| 31 | |
| 32 | # To create other directories, as needed, and timestamp their creation |
| 33 | %/.dir: |
| 34 | -mkdir $* > /dev/null |
| 35 | date > $@ |
| 36 | |
| 37 | else |
| 38 | |
| 39 | # Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info. |
| 40 | LEVEL := ../../../.. |
| 41 | include $(LEVEL)/Makefile.common |
| 42 | |
| 43 | CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER) |
| 44 | |
| 45 | SRC_DOC_DIR=$(PROJ_SRC_DIR)/ |
| 46 | DST_HTML_DIR=$(PROJ_OBJ_DIR)/ |
| 47 | DST_MAN_DIR=$(PROJ_OBJ_DIR)/ |
| 48 | DST_PS_DIR=$(PROJ_OBJ_DIR)/ |
| 49 | |
| 50 | endif |
| 51 | |
| 52 | |
| 53 | POD := $(wildcard $(SRC_DOC_DIR)*.pod) |
| 54 | HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD)) |
| 55 | MAN := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD)) |
| 56 | PS := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD)) |
| 57 | |
| 58 | ifdef ONLY_MAN_DOCS |
| 59 | INSTALL_TARGETS := install-man |
| 60 | else |
| 61 | INSTALL_TARGETS := install-html install-man install-ps |
| 62 | endif |
| 63 | |
| 64 | .SUFFIXES: |
| 65 | .SUFFIXES: .html .pod .1 .ps |
| 66 | |
| 67 | $(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir |
| 68 | pod2html --css=manpage.css --htmlroot=. \ |
| 69 | --podpath=. --infile=$< --outfile=$@ --title=$* |
| 70 | |
| 71 | $(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir |
| 72 | pod2man --release "clang $(CLANG_VERSION)" --center="Clang Tools Documentation" $< $@ |
| 73 | |
| 74 | $(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir |
| 75 | groff -Tps -man $< > $@ |
| 76 | |
| 77 | |
| 78 | html: $(HTML) |
| 79 | man: $(MAN) |
| 80 | ps: $(PS) |
| 81 | |
| 82 | EXTRA_DIST := $(POD) |
| 83 | |
| 84 | clean-local:: |
| 85 | $(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) |
| 86 | |
| 87 | HTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/clang |
| 88 | MAN_DIR := $(DESTDIR)$(PROJ_mandir)/man1 |
| 89 | PS_DIR := $(DESTDIR)$(PROJ_docsdir)/ps |
| 90 | |
| 91 | install-html:: $(HTML) |
| 92 | $(Echo) Installing HTML Clang Tools Documentation |
| 93 | $(Verb) $(MKDIR) $(HTML_DIR) |
| 94 | $(Verb) $(DataInstall) $(HTML) $(HTML_DIR) |
| 95 | $(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR) |
| 96 | |
| 97 | install-man:: $(MAN) |
| 98 | $(Echo) Installing MAN Clang Tools Documentation |
| 99 | $(Verb) $(MKDIR) $(MAN_DIR) |
| 100 | $(Verb) $(DataInstall) $(MAN) $(MAN_DIR) |
| 101 | |
| 102 | install-ps:: $(PS) |
| 103 | $(Echo) Installing PS Clang Tools Documentation |
| 104 | $(Verb) $(MKDIR) $(PS_DIR) |
| 105 | $(Verb) $(DataInstall) $(PS) $(PS_DIR) |
| 106 | |
| 107 | install-local:: $(INSTALL_TARGETS) |
| 108 | |
| 109 | uninstall-local:: |
| 110 | $(Echo) Uninstalling Clang Tools Documentation |
| 111 | $(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR) |
| 112 | |
| 113 | printvars:: |
| 114 | $(Echo) "POD : " '$(POD)' |
| 115 | $(Echo) "HTML : " '$(HTML)' |