Home | History | Annotate | Download | only in docs
      1 ##===- docs/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 LEVEL      := ..
     11 DIRS       :=
     12 
     13 ifdef BUILD_FOR_WEBSITE
     14 PROJ_OBJ_DIR = .
     15 DOXYGEN = doxygen
     16 
     17 $(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
     18 	cat $< | sed \
     19 	  -e 's/@DOT@/dot/g' \
     20 	  -e 's/@PACKAGE_VERSION@/mainline/' \
     21 	  -e 's/@abs_top_builddir@/../g' \
     22 	  -e 's/@abs_top_srcdir@/../g' \
     23 	  -e 's/@enable_external_search@/NO/g' \
     24 	  -e 's/@enable_searchengine@/NO/g' \
     25 	  -e 's/@enable_server_based_search@/NO/g' \
     26 	  -e 's/@extra_search_mappings@//g' \
     27 	  -e 's/@llvm_doxygen_generate_qhp@//g' \
     28 	  -e 's/@llvm_doxygen_qch_filename@//g' \
     29 	  -e 's/@llvm_doxygen_qhelpgenerator_path@//g' \
     30 	  -e 's/@llvm_doxygen_qhp_cust_filter_attrs@//g' \
     31 	  -e 's/@llvm_doxygen_qhp_cust_filter_name@//g' \
     32 	  -e 's/@llvm_doxygen_qhp_namespace@//g' \
     33 	  -e 's/@searchengine_url@//g' \
     34 	  -e 's/@DOT_IMAGE_FORMAT@/png/g' \
     35 	  > $@
     36 endif
     37 
     38 include $(LEVEL)/Makefile.common
     39 
     40 HTML       := $(wildcard $(PROJ_SRC_DIR)/*.html) \
     41               $(wildcard $(PROJ_SRC_DIR)/*.css)
     42 DOXYFILES  := doxygen.cfg.in doxygen.intro
     43 
     44 .PHONY: install-html install-doxygen doxygen install-ocamldoc ocamldoc generated
     45 
     46 install_targets := install-html
     47 ifeq ($(ENABLE_DOXYGEN),1)
     48 install_targets += install-doxygen
     49 endif
     50 ifdef OCAMLFIND
     51 ifneq (,$(filter ocaml,$(BINDINGS_TO_BUILD)))
     52 install_targets += install-ocamldoc
     53 endif
     54 endif
     55 install-local:: $(install_targets)
     56 
     57 generated_targets := doxygen
     58 ifdef OCAMLFIND
     59 generated_targets += ocamldoc
     60 endif
     61 
     62 # Live documentation is generated for the web site using this target:
     63 # 'make generated BUILD_FOR_WEBSITE=1'
     64 generated:: $(generated_targets)
     65 
     66 install-html: $(PROJ_OBJ_DIR)/html.tar.gz
     67 	$(Echo) Installing HTML documentation
     68 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
     69 	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
     70 	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
     71 
     72 $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
     73 	$(Echo) Packaging HTML documentation
     74 	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/html.tar
     75 	$(Verb) cd $(PROJ_SRC_DIR) && \
     76 	  $(TAR) cf $(PROJ_OBJ_DIR)/html.tar *.html
     77 	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/html.tar
     78 
     79 install-doxygen: doxygen
     80 	$(Echo) Installing doxygen documentation
     81 	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
     82 	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen/html && \
     83 	  for DIR in $$($(FIND) . -type d); do \
     84 	    DESTSUB="$(DESTDIR)$(PROJ_docsdir)/html/doxygen/$$(echo $$DIR | cut -c 3-)"; \
     85 	    $(MKDIR) $$DESTSUB && \
     86 	    $(FIND) $$DIR -maxdepth 1 -type f -exec $(DataInstall) {} $$DESTSUB \; ; \
     87 	    if [ $$? != 0 ]; then exit 1; fi \
     88 	  done
     89 
     90 doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
     91 
     92 regendoc:
     93 	$(Echo) Building doxygen documentation
     94 	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/doxygen
     95 	$(Verb) $(DOXYGEN) $(PROJ_OBJ_DIR)/doxygen.cfg
     96 
     97 $(PROJ_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(PROJ_OBJ_DIR)/doxygen.cfg
     98 	$(Echo) Packaging doxygen documentation
     99 	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/doxygen.tar
    100 	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/doxygen.tar doxygen
    101 	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/doxygen.tar
    102 	$(Verb) $(CP) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_OBJ_DIR)/doxygen/html/
    103 
    104 userloc: $(LLVM_SRC_ROOT)/docs/userloc.html
    105 
    106 $(LLVM_SRC_ROOT)/docs/userloc.html:
    107 	$(Echo) Making User LOC Table
    108 	$(Verb) cd $(LLVM_SRC_ROOT) ; ./utils/userloc.pl -details -recurse \
    109 	  -html lib include tools runtime utils examples autoconf test > docs/userloc.html
    110 
    111 install-ocamldoc: ocamldoc
    112 	$(Echo) Installing ocamldoc documentation
    113 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
    114 	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
    115 	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
    116 	  $(FIND) . -type f -exec \
    117 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
    118 
    119 ocamldoc: regen-ocamldoc
    120 	$(Echo) Packaging ocamldoc documentation
    121 	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
    122 	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
    123 	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
    124 	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
    125 
    126 regen-ocamldoc:
    127 	$(Echo) Building ocamldoc documentation
    128 	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc
    129 	$(Verb) $(MAKE) -C $(LEVEL)/bindings/ocaml ocamldoc
    130 	$(Verb) $(MKDIR) $(PROJ_OBJ_DIR)/ocamldoc/html
    131 	$(Verb) \
    132 		$(OCAMLFIND) ocamldoc -d $(PROJ_OBJ_DIR)/ocamldoc/html -sort -colorize-code -html \
    133 		`$(FIND) $(LEVEL)/bindings/ocaml -name "*.odoc" \
    134 		         -path "*/$(BuildMode)/*.odoc" -exec echo -load '{}' ';'`
    135 
    136 uninstall-local::
    137 	$(Echo) Uninstalling Documentation
    138 	$(Verb) $(RM) -rf $(DESTDIR)$(PROJ_docsdir)
    139