Updated VS build system. Patch provided by Cedric Venet:
[oota-llvm.git] / docs / CommandGuide / Makefile
index ee5834cda7d60c8c128ab17087decd8d0bba6e88..cf77e6a33db06428b4512e67be657da7b13cff8b 100644 (file)
@@ -2,8 +2,8 @@
 # 
 #                     The LLVM Compiler Infrastructure
 #
-# This file was developed by the LLVM research group and is distributed under
-# the University of Illinois Open Source License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 # 
 ##===----------------------------------------------------------------------===##
 
@@ -13,72 +13,85 @@ ifdef BUILD_FOR_WEBSITE
 # the POD files to HTML only and keep them in the src directories. It must also
 # build in an unconfigured tree, hence the ifdef. To use this, run
 # make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
+SRC_DOC_DIR=
+DST_HTML_DIR=html/
+DST_MAN_DIR=man/man1/
+DST_PS_DIR=ps/
 
-POD  := $(wildcard *.pod)
-HTML := $(patsubst %.pod,html/%.html, $(POD))
+# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
+all:: html man ps
 
-all: $(HTML)
+clean:
+       rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
 
-html/%.html : %.pod
-       pod2html --css=manpage.css --htmlroot=. --podpath=. \
-         --noindex --infile=$< --outfile=$@ --title=$*
+# To create other directories, as needed, and timestamp their creation
+%/.dir:
+       -mkdir $* > /dev/null
+       date > $@
 
-else 
+else
 
+# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
 LEVEL := ../..
-
 include $(LEVEL)/Makefile.common
 
-POD := $(wildcard $(BUILD_SRC_DIR)/*.pod)
+SRC_DOC_DIR=$(PROJ_SRC_DIR)/
+DST_HTML_DIR=$(PROJ_OBJ_DIR)/
+DST_MAN_DIR=$(PROJ_OBJ_DIR)/
+DST_PS_DIR=$(PROJ_OBJ_DIR)/
 
-EXTRA_DIST := $(POD) index.html
+endif
 
-HTML = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.html, $(POD))
-MAN = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.1, $(POD))
-PS = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.ps, $(POD))
+
+POD  := $(wildcard $(SRC_DOC_DIR)*.pod)
+HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
+MAN  := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
+PS   := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
 
 .SUFFIXES:
 .SUFFIXES: .html .pod .1 .ps
 
-$(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir
+$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
+       pod2html --css=manpage.css --htmlroot=. \
+         --podpath=. --noindex --infile=$< --outfile=$@ --title=$*
+
+$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
+       pod2man --release=CVS --center="LLVM Command Guide" $< $@
 
-$(BUILD_OBJ_DIR)/%.html: %.pod
-       $(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \
-         --noindex --infile=$< --outfile=$@ --title=$*
+$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
+       groff -Tps -man $< > $@
 
-$(BUILD_OBJ_DIR)/%.1: %.pod
-       $(POD2MAN) --release=$(PACKAGE_VERSION) \
-         --center="LLVM Command Guide" $< $@
 
-$(BUILD_OBJ_DIR)/%.ps: $(BUILD_OBJ_DIR)/%.1
-       $(GROFF) -Tps -man $< > $@
+html: $(HTML)
+man: $(MAN)
+ps: $(PS)
+
+EXTRA_DIST := $(POD) index.html
 
 clean-local::
        $(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
 
-HTML_DIR := $(LLVM_DOCSDIR)/html/CommandGuide
-MAN_DIR  := $(LLVM_MANDIR)/man1
-PS_DIR   := $(LLVM_DOCSDIR)/ps
+HTML_DIR := $(PROJ_docsdir)/html/CommandGuide
+MAN_DIR  := $(PROJ_mandir)/man1
+PS_DIR   := $(PROJ_docsdir)/ps
 
 install-local:: $(HTML) $(MAN) $(PS)
        $(Echo) Installing HTML CommandGuide Documentation
-       $(Verb) $(INSTALL) -d $(HTML_DIR)
-       $(Verb) $(INSTALL) -C $(HTML) $(HTML_DIR)
-       $(Verb) $(INSTALL) -C $(BUILD_SRC_DIR)/index.html $(HTML_DIR)
-       $(Verb) $(INSTALL) -C $(BUILD_SRC_DIR)/manpage.css $(HTML_DIR)
+       $(Verb) $(MKDIR) $(HTML_DIR)
+       $(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
+       $(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR)
+       $(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
        $(Echo) Installing MAN CommandGuide Documentation
-       $(Verb) $(INSTALL) -d $(MAN_DIR)
-       $(Verb) $(INSTALL) -C $(MAN) $(MAN_DIR)
+       $(Verb) $(MKDIR) $(MAN_DIR)
+       $(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
        $(Echo) Installing PS CommandGuide Documentation
-       $(Verb) $(INSTALL) -d $(PS_DIR)
-       $(Verb) $(INSTALL) -C $(PS) $(PS_DIR)
+       $(Verb) $(MKDIR) $(PS_DIR)
+       $(Verb) $(DataInstall) $(PS) $(PS_DIR)
 
 uninstall-local::
-       $(Echo) Uninstalling Documentation
-       $(Verb) $(RM) -rf $(LLVM_DOCSDIR)
+       $(Echo) Uninstalling CommandGuide Documentation
+       $(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
 
 printvars::
        $(Echo) "POD            : " '$(POD)'
        $(Echo) "HTML           : " '$(HTML)'
-
-endif