Fixes in Makefile
[iooclient] / Makefile
1 # Makefile for Iooclient
2 #
3
4 # You can set these variables from the command line.
5 VERSION         = "0.7.1"
6 SPHINXOPTS      = -D version=$(VERSION) -D release=$(VERSION)
7 IOODIR                  = iooclient
8 DOCSDIR                 = docs
9 SPHINXBUILD             = sphinx-build
10 EPYBUILD                = epydoc
11 EPYCONF                 = source
12 APIDIR                  = api
13 HTMLDIR                 = html
14 DOCSDIR                 = docs
15 SRCDIR          = source
16 PAPER                   =
17 BUILDDIR                = docbuild
18 IOOBUILD                = build
19
20 # Internal variables.
21 PAPEROPT_a4     = -D latex_paper_size=a4
22 PAPEROPT_letter = -D latex_paper_size=letter
23 ALLSPHINXOPTS   = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
24 SPHINXFILES     = $(DOCSDIR)/$(SRCDIR)/*
25
26 tag = $(shell git describe --abbrev=0)
27 ver = $(shell git describe --abbrev=0 | egrep -o '([0-9]+\.){1,10}[0-9]+' | sed -e 's/\./_/g')
28 name       = $(shell basename $(shell pwd))
29
30 .PHONY: help html api dist distclean docclean install
31
32 help:
33         @echo "Please use \`make <target>' where <target> is one of"
34         @echo "  doc            to make html and api doc"
35         @echo "  dist           to make distribution file"
36         @echo "  docclean       to clean up API and HTML docuentation"
37         @echo "  distclean      to clean docs, archive and installation build files"
38         @echo "  html           to make standalone sphinx HTML files"
39         @echo "  api            to make standalone epydoc API files"
40         @echo "  install        to install the IOOclient library"
41         
42         
43 dist:
44         git archive --format tar --prefix $(name)-$(ver)/ -o $(name)-$(ver).tar $(tag)
45         gzip -f $(name)-$(ver).tar
46
47 docclean:
48         @rm -rf $(BUILDDIR)
49         @echo "Removed $(BUILDDIR)"
50
51 distclean:
52         @rm -f *tar.gz
53         @echo "Removed tar.gz (if any)"
54         @rm -rf $(BUILDDIR)/$(APIDIR)
55         @echo "Removed the API directory (if any)"
56         @rm -rf $(BUILDDIR)/$(HTMLDIR)
57         @echo "Removed the HTML directory (if any)"
58         @sudo rm -rf $(IOOBUILD)
59         @echo "Removed the $(IOOBUILD) directory (if any)"
60         
61 doc:    $(BUILDDIR)/api $(BUILDDIR)/html
62
63 install:
64         @sudo python setup.py install
65
66
67 $(BUILDDIR)/api:
68         @mkdir -p $(BUILDDIR)/$(APIDIR)
69         $(EPYBUILD) -v -c $(DOCSDIR)/$(EPYCONF)/epydoc.conf --exclude migrations -o $(BUILDDIR)/$(APIDIR) $(IOODIR)
70         @echo
71         @echo "Build finished. The API pages are in $(BUILDDIR)/$(APIDIR)"
72
73 $(BUILDDIR)/html: $(SPHINXFILES)
74         @mkdir -p $(BUILDDIR)
75         @test -n "sphinx-build" || \
76                 { echo 'sphinx-build' not found during configure; exit 1; }
77         sphinx-build -b html \
78                 $(ALLSPHINXOPTS) -d $(BUILDDIR)/doctrees $(DOCSDIR)/$(SRCDIR) $(BUILDDIR)/html