Home | History | Annotate | Download | only in CommandGuide
      1 ##===- docs/CommandGuide/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 # 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.

     16 SRC_DOC_DIR=
     17 DST_HTML_DIR=html/
     18 DST_MAN_DIR=man/man1/
     19 DST_PS_DIR=ps/
     20 
     21 # If we are in BUILD_FOR_WEBSITE mode, default to the all target.

     22 all:: html man ps
     23 
     24 clean:
     25 	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
     26 
     27 # To create other directories, as needed, and timestamp their creation

     28 %/.dir:
     29 	-mkdir $* > /dev/null
     30 	date > $@
     31 
     32 else
     33 
     34 # Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.

     35 LEVEL := ../..
     36 include $(LEVEL)/Makefile.common
     37 
     38 SRC_DOC_DIR=$(PROJ_SRC_DIR)/
     39 DST_HTML_DIR=$(PROJ_OBJ_DIR)/
     40 DST_MAN_DIR=$(PROJ_OBJ_DIR)/
     41 DST_PS_DIR=$(PROJ_OBJ_DIR)/
     42 
     43 endif
     44 
     45 
     46 POD  := $(wildcard $(SRC_DOC_DIR)*.pod)
     47 HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
     48 MAN  := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
     49 PS   := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
     50 
     51 # The set of man pages we will not install

     52 NO_INSTALL_MANS = $(DST_MAN_DIR)FileCheck.1
     53 
     54 # The set of man pages that we will install

     55 INSTALL_MANS = $(filter-out $(NO_INSTALL_MANS), $(MAN))
     56 
     57 .SUFFIXES:
     58 .SUFFIXES: .html .pod .1 .ps
     59 
     60 $(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 
     70 
     71 html: $(HTML)
     72 man: $(MAN)
     73 ps: $(PS)
     74 
     75 EXTRA_DIST := $(POD) index.html
     76 
     77 clean-local::
     78 	$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
     79 
     80 HTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/CommandGuide
     81 MAN_DIR  := $(DESTDIR)$(PROJ_mandir)/man1
     82 PS_DIR   := $(DESTDIR)$(PROJ_docsdir)/ps
     83 
     84 install-local:: $(HTML) $(INSTALL_MANS) $(PS)
     85 	$(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)
     92 	$(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
     93 	$(Echo) Installing PS CommandGuide Documentation
     94 	$(Verb) $(MKDIR) $(PS_DIR)
     95 	$(Verb) $(DataInstall) $(PS) $(PS_DIR)
     96 
     97 uninstall-local::
     98 	$(Echo) Uninstalling CommandGuide Documentation
     99 	$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
    100 
    101 printvars::
    102 	$(Echo) "POD            : " '$(POD)'
    103 	$(Echo) "HTML           : " '$(HTML)'
    104