This repository has been archived by the owner on Mar 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
GNUmakefile
136 lines (101 loc) · 3.78 KB
/
GNUmakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# ============================================================================
# This makefile is intended for developers. End users should rely on setup.py.
# ============================================================================
# Copyright (C) 2004, 2005, 2006, 2010 Juan M. Bello Rivas <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
srcdir := .
scriptsdir := $(srcdir)/scripts
modulesdir := $(srcdir)/Halberd
docdir := $(srcdir)/doc
apidocdir := $(srcdir)/doc/api
mandir := $(srcdir)/man
testdir := $(srcdir)/tests
PYTHON := /usr/bin/python
PYTHON_COUNT := /usr/local/bin/python_count
PYLINT := /usr/bin/pylint
EPYDOC := /usr/bin/epydoc
CTAGS := ctags
GITLOG_TO_CHANGELOG := /usr/share/gnulib/build-aux/gitlog-to-changelog
SHTOOLIZE := /usr/bin/shtoolize
SHTOOL := $(srcdir)/shtool
RM := /bin/rm -f
MKDIR := /bin/mkdir
SETUP := $(PYTHON) $(srcdir)/setup.py
HELP2MAN := help2man
versionfile := $(modulesdir)/version.py
SCRIPTS := $(scriptsdir)/halberd
MODULES := $(filter-out $(modulesdir)/version.py, \
$(wildcard $(modulesdir)/*.py)) \
$(wildcard $(modulesdir)/clues/*.py)
SOURCES := $(SCRIPTS) $(MODULES)
TEST_SOURCES := $(wildcard $(testdir)/*.py)
ALL_SOURCES := $(SOURCES) $(TEST_SOURCES)
ALL_DIRS := $(sort $(dir $(ALL_SOURCES)))
remove = $(RM) $(addsuffix $(strip $(1)), $(2))
all:
@echo "============================================================================"
@echo "This makefile is intended for developers. End users should rely on setup.py."
@echo "============================================================================"
clean:
$(RM) tags
$(RM) -r $(srcdir)/build
$(call remove, *.pyc, $(ALL_DIRS))
$(call remove, *.pyo, $(ALL_DIRS))
$(MAKE) -C doc clean
clobber: clean
$(RM) *.bak
$(call remove, *~, $(ALL_DIRS) $(docdir)/)
$(MAKE) -C doc clobber
build: $(SOURCES)
$(SETUP) build
dist: distclean setversion doc ChangeLog
$(SETUP) sdist
check: $(ALL_SOURCES)
$(SETUP) test
PYTHONPATH=$(modulesdir):$(modulesdir)/clues:$$PYTHONPATH \
$(PYTHON) $(modulesdir)/clues/analysis.py
install: build doc
$(SETUP) install --prefix $$HOME
distclean: clobber
$(RM) $(srcdir)/MANIFEST
$(RM) $(srcdir)/ChangeLog
$(RM) $(docdir)/*.html
$(RM) $(mandir)/man1/halberd.1
$(RM) -r $(apidocdir)
$(RM) -r $(srcdir)/dist
doc: $(apidocdir)/index.html $(mandir)/man1/halberd.1
$(MAKE) -C $(docdir)
$(apidocdir)/index.html: $(MODULES)
$(EPYDOC) -o $(apidocdir) $^
$(mandir)/man1/halberd.1:
$(HELP2MAN) --include $(srcdir)/help2man.cfg --no-info $(scriptsdir)/halberd --output $@
tags: $(ALL_SOURCES)
$(CTAGS) $^
setversion: shtool
@version=`$(SHTOOL) version -l python $(versionfile)`; \
$(SHTOOL) version -l python -n halberd -s $$version $(versionfile)
incversion: shtool
$(SHTOOL) version -l python -n halberd -i l $(versionfile)
shtool:
$(SHTOOLIZE) -o $@ version
lint:
$(PYLINT) --required-attributes= --additional-builtins=map,filter --method-rgx='.*' --function-rgx='.*' $(ALL_SOURCES)
ChangeLog: $(ALL_SOURCES)
$(GITLOG_TO_CHANGELOG) > ChangeLog
count: $(ALL_SOURCES)
@$(PYTHON_COUNT) $^
.PHONY: clean clobber distclean dist setversion incversion check count install lint ChangeLog
# vim: noexpandtab