Fixes in Makefile master v0.7.1
authorLeonidas Poulopoulos <leopoul@noc.grnet.gr>
Fri, 8 Feb 2013 09:25:50 +0000 (11:25 +0200)
committerLeonidas Poulopoulos <leopoul@noc.grnet.gr>
Fri, 8 Feb 2013 09:25:50 +0000 (11:25 +0200)
Makefile

index f98398b..83a4d64 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,23 +2,26 @@
 #
 
 # You can set these variables from the command line.
-
-IOODIR = iooclient
-DOCSDIR = docs
-SPHINXOPTS    =
-SPHINXBUILD   = sphinx-build
-EPYBUILD         = epydoc
-EPYCONF          = source
-APIDIR           = api
-HTMLDIR                  = html
-PAPER         =
-BUILDDIR      = $(DOCSDIR)/build
-IOOBUILD         = build
+VERSION                = "0.7.1"
+SPHINXOPTS      = -D version=$(VERSION) -D release=$(VERSION)
+IOODIR                         = iooclient
+DOCSDIR                = docs
+SPHINXBUILD            = sphinx-build
+EPYBUILD               = epydoc
+EPYCONF                        = source
+APIDIR                 = api
+HTMLDIR                        = html
+DOCSDIR                        = docs
+SRCDIR          = source
+PAPER                  =
+BUILDDIR               = docbuild
+IOOBUILD               = build
 
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
 PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+ALLSPHINXOPTS   = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
+SPHINXFILES     = $(DOCSDIR)/$(SRCDIR)/*
 
 tag = $(shell git describe --abbrev=0)
 ver = $(shell git describe --abbrev=0 | egrep -o '([0-9]+\.){1,10}[0-9]+' | sed -e 's/\./_/g')
@@ -55,21 +58,21 @@ distclean:
        @sudo rm -rf $(IOOBUILD)
        @echo "Removed the $(IOOBUILD) directory (if any)"
        
-doc:
-       html api
+doc:   $(BUILDDIR)/api $(BUILDDIR)/html
+
+install:
+       @sudo python setup.py install
 
-html:
-       $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/$(HTMLDIR)
-       @echo
-       @echo "Build finished. The HTML pages are in $(BUILDDIR)/$(HTMLDIR)."
 
-api:
+$(BUILDDIR)/api:
        @mkdir -p $(BUILDDIR)/$(APIDIR)
        $(EPYBUILD) -v -c $(DOCSDIR)/$(EPYCONF)/epydoc.conf --exclude migrations -o $(BUILDDIR)/$(APIDIR) $(IOODIR)
        @echo
        @echo "Build finished. The API pages are in $(BUILDDIR)/$(APIDIR)"
 
-install:
-       @sudo python setup.py install
-
-
+$(BUILDDIR)/html: $(SPHINXFILES)
+       @mkdir -p $(BUILDDIR)
+       @test -n "sphinx-build" || \
+               { echo 'sphinx-build' not found during configure; exit 1; }
+       sphinx-build -b html \
+               $(ALLSPHINXOPTS) -d $(BUILDDIR)/doctrees $(DOCSDIR)/$(SRCDIR) $(BUILDDIR)/html