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