Bumped to version 1.0.0
[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 DB2MAN = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
31 DB2HTML = http://docbook.sourceforge.net/release/xsl-ns/current/html/docbook.xsl
32 XP = /usr/bin/xsltproc --nonet --param man.charmap.use.subset "0" \
33         --param make.year.ranges "1" --param make.single.year.ranges "1"
34
35 #PATH = /usr/bin:/bin  # must include sphinx-build for 'sphinx' target.
36
37 #PREFIX = /usr/local
38 PREFIX = ${HOME}
39 INSTALL_OPTIONS = "--prefix=${PREFIX}"
40
41 # Select the documentation you wish to build
42 DOC = sphinx man
43
44 # Directories with semantic meaning
45 DOC_DIR := doc
46 MAN_DIR := ${DOC_DIR}/man
47
48 MANPAGES = be.1
49 LIBBE_VERSION := libbe/_version.py
50 GENERATED_FILES := build $(LIBBE_VERSION)
51
52 MANPAGE_FILES = $(patsubst %,${MAN_DIR}/%,${MANPAGES})
53 GENERATED_FILES += ${MANPAGE_FILES}
54
55 \f
56 .PHONY: all
57 all: build
58
59 \f
60 .PHONY: build
61 build: $(LIBBE_VERSION)
62         python setup.py build
63
64 .PHONY: doc
65 doc: $(DOC)
66
67 .PHONY: install
68 install: build doc
69         python setup.py install ${INSTALL_OPTIONS}
70
71 test: build
72         python test.py
73
74 .PHONY: clean
75 clean:
76         $(RM) -rf ${GENERATED_FILES}
77         $(MAKE) -C ${DOC_DIR} clean
78
79 \f
80 .PHONY: libbe/_version.py
81 libbe/_version.py:
82         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' > $@
83
84 .PHONY: man
85 man: ${MANPAGE_FILES}
86
87 %.1: %.1.xml
88         $(XP) -o $@ $(DB2MAN) $<
89 %.1.html: %.1.xml
90         $(XP) -o $@ $(DB2HTML) $<
91
92 .PHONY: sphinx
93 sphinx:
94         $(MAKE) -C ${DOC_DIR} html