ca8e735eed844b9944a7356d0cc1df60a96acf9f
[be.git] / Makefile
1 #! /usr/bin/make -f
2 # :vim: filetype=make : -*- makefile; coding: utf-8; -*-
3
4 # Makefile
5 # Part of Bugs Everywhere, a distributed bug tracking system.
6 #
7 # Copyright (C) 2008-2011 Anton Batenev <abbat@abbat>
8 #                         Ben Finney <benf@cybersource.com.au>
9 #                         Eric Kow <eric.kow@gmail.com>
10 #                         Gianluca Montecchi <gian@grys.it>
11 #                         W. Trevor King <wking@drexel.edu>
12 #
13 # This file is part of Bugs Everywhere.
14 #
15 # Bugs Everywhere is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by the
17 # Free Software Foundation, either version 2 of the License, or (at your
18 # option) any later version.
19 #
20 # Bugs Everywhere is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 # General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with Bugs Everywhere.  If not, see <http://www.gnu.org/licenses/>.
27
28 SHELL = /bin/bash
29 RM = /bin/rm
30 RST2MAN = /usr/bin/rst2man
31 RST2HTML = /usr/bin/rst2html
32
33 #PATH = /usr/bin:/bin  # must include sphinx-build for 'sphinx' target.
34
35 #INSTALL_OPTIONS = "--prefix=/usr/local"
36 INSTALL_OPTIONS = "--user"
37
38 # Select the documentation you wish to build
39 DOC = sphinx man
40
41 # Directories with semantic meaning
42 DOC_DIR := doc
43 MAN_DIR := ${DOC_DIR}/man
44
45 MANPAGES = be.1
46 LIBBE_VERSION := libbe/_version.py
47 GENERATED_FILES := build $(LIBBE_VERSION)
48
49 MANPAGE_FILES = $(patsubst %,${MAN_DIR}/%,${MANPAGES})
50 MANPAGE_HTML =  $(patsubst %,${MAN_DIR}/%.html,${MANPAGES})
51 GENERATED_FILES += ${MANPAGE_FILES} ${MANPAGE_HTML}
52
53 \f
54 .PHONY: all
55 all: build
56
57 \f
58 .PHONY: build
59 build: $(LIBBE_VERSION)
60         python setup.py build
61
62 .PHONY: doc
63 doc: $(DOC)
64
65 .PHONY: install
66 install: build doc
67         python setup.py install ${INSTALL_OPTIONS}
68
69 test: build
70         python test.py
71
72 .PHONY: clean
73 clean:
74         $(RM) -rf ${GENERATED_FILES}
75         $(MAKE) -C ${DOC_DIR} clean
76
77 \f
78 .PHONY: libbe/_version.py
79 libbe/_version.py:
80         git log -1 --date=short --pretty='format:"Autogenerated by make libbe/_version.py"%nversion_info = {%n    "date":"%cd",%n    "revision":"%H",%n    "committer":"%cn"}%n' > $@
81
82 .PHONY: man
83 man: ${MANPAGE_FILES}
84
85 %.1: %.1.txt
86         $(RST2MAN) $< > $@
87 %.1.html: %.1.txt
88         $(RST2HTML) $< > $@
89
90 .PHONY: sphinx
91 sphinx:
92         $(MAKE) -C ${DOC_DIR} html