forked from gpodder/gpodder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
171 lines (126 loc) · 5.62 KB
/
makefile
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2018 The gPodder Team
#
# gPodder 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 3 of the License, or
# (at your option) any later version.
#
# gPodder 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, see <http://www.gnu.org/licenses/>.
#
#
##########################################################################
BINFILE = bin/gpodder
MANPAGES = share/man/man1/gpodder.1 share/man/man1/gpo.1
GPODDER_SERVICE_FILE=share/dbus-1/services/org.gpodder.service
GPODDER_SERVICE_FILE_IN=$(addsuffix .in,$(GPODDER_SERVICE_FILE))
DESKTOP_FILES_IN=$(wildcard share/applications/*.desktop.in)
DESKTOP_FILES_IN_H=$(patsubst %.desktop.in,%.desktop.in.h,$(DESKTOP_FILES_IN))
DESKTOP_FILES=$(patsubst %.desktop.in,%.desktop,$(DESKTOP_FILES_IN))
MESSAGES = po/messages.pot
POFILES = $(wildcard po/*.po)
LOCALEDIR = share/locale
MOFILES = $(patsubst po/%.po,$(LOCALEDIR)/%/LC_MESSAGES/gpodder.mo, $(POFILES))
UIFILES=$(wildcard share/gpodder/ui/gtk/*.ui)
UIFILES_H=$(subst .ui,.ui.h,$(UIFILES))
GETTEXT_SOURCE=$(wildcard src/gpodder/*.py \
src/gpodder/gtkui/*.py \
src/gpodder/gtkui/interface/*.py \
src/gpodder/gtkui/desktop/*.py \
src/gpodder/plugins/*.py \
share/gpodder/extensions/*.py)
GETTEXT_SOURCE += $(UIFILES_H)
GETTEXT_SOURCE += $(wildcard bin/*[^~])
GETTEXT_SOURCE += $(DESKTOP_FILES_IN_H)
DESTDIR ?= /
PREFIX ?= /usr
PYTHON ?= python3
HELP2MAN ?= help2man
##########################################################################
help:
@cat tools/make-help.txt
##########################################################################
unittest:
LC_ALL=C PYTHONPATH=src/ $(PYTHON) -m gpodder.unittests
ISORTOPTS := -rc -c share src/gpodder tools bin/* *.py
lint:
pycodestyle share src/gpodder tools bin/* *.py
isort -q $(ISORTOPTS) || isort -df $(ISORTOPTS)
release: distclean
$(PYTHON) setup.py sdist
releasetest: unittest $(DESKTOP_FILES) $(POFILES)
for f in $(DESKTOP_FILES); do desktop-file-validate $$f; done
for f in $(POFILES); do msgfmt --check $$f; done
$(GPODDER_SERVICE_FILE): $(GPODDER_SERVICE_FILE_IN)
sed -e 's#__PREFIX__#$(PREFIX)#' $< >$@
%.desktop: %.desktop.in $(POFILES)
sed -e 's#__PREFIX__#$(PREFIX)#' $< >$@.tmp
intltool-merge -d -u po $@.tmp $@
rm -f $@.tmp
%.desktop.in.h: %.desktop.in
intltool-extract --quiet --type=gettext/ini $<
install: messages $(GPODDER_SERVICE_FILE) $(DESKTOP_FILES)
$(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) --optimize=1
install-win: messages $(GPODDER_SERVICE_FILE) $(DESKTOP_FILES)
$(PYTHON) setup.py install
##########################################################################
ifdef VERSION
revbump:
LC_ALL=C sed -i "s/\(__version__\s*=\s*'\).*'/\1$(VERSION)'/" src/gpodder/__init__.py
LC_ALL=C sed -i "s/\(__date__\s*=\s*'\).*'/\1$(shell date "+%Y-%m-%d")'/" src/gpodder/__init__.py
LC_ALL=C sed -i "s/\(__copyright__\s*=.*2005-\)[0-9]*\(.*\)/\1$(shell date "+%Y")\2/" src/gpodder/__init__.py
$(MAKE) messages manpages
else
revbump:
@echo "Usage: make revbump VERSION=x.y.z"
endif
##########################################################################
manpages: $(MANPAGES)
share/man/man1/gpodder.1: src/gpodder/__init__.py $(BINFILE)
LC_ALL=C $(HELP2MAN) --name="$(shell $(PYTHON) setup.py --description)" -N $(BINFILE) >$@
share/man/man1/gpo.1: src/gpodder/__init__.py
sed -i 's/^\.TH.*/.TH GPO "1" "$(shell LANG=en date "+%B %Y")" "gpodder $(shell $(PYTHON) setup.py --version)" "User Commands"/' $@
##########################################################################
messages: $(MOFILES)
%.po: $(MESSAGES)
msgmerge --previous --silent $@ $< --output-file=$@
msgattrib --set-obsolete --ignore-file=$< -o $@ $@
msgattrib --no-obsolete -o $@ $@
$(LOCALEDIR)/%/LC_MESSAGES/gpodder.mo: po/%.po
@mkdir -p $(@D)
msgfmt $< -o $@
%.ui.h: %.ui
intltool-extract --quiet --type=gettext/glade $<
$(MESSAGES): $(GETTEXT_SOURCE)
xgettext --from-code=utf-8 -LPython -k_:1 -kN_:1 -kN_:1,2 -kn_:1,2 -o $(MESSAGES) $^
messages-force:
xgettext --from-code=utf-8 -LPython -k_:1 -kN_:1 -kN_:1,2 -kn_:1,2 -o $(MESSAGES) $(GETTEXT_SOURCE)
##########################################################################
# This only works in a Git working commit, and assumes that the local Git
# HEAD has already been pushed to the main repository. It's mainly useful
# for the gPodder maintainer to quickly generate a commit link that can be
# posted online in bug trackers and mailing lists.
headlink:
@echo http://gpodder.org/commit/`git show-ref HEAD | head -c8`
##########################################################################
clean:
$(PYTHON) setup.py clean
find src/ '(' -name '*.pyc' -o -name '*.pyo' ')' -exec rm '{}' +
find src/ -type d -name '__pycache__' -exec rm -r '{}' +
find share/gpodder/ui/ -name '*.ui.h' -exec rm '{}' +
rm -f MANIFEST .coverage messages.mo po/*.mo
rm -f $(GPODDER_SERVICE_FILE)
rm -f $(DESKTOP_FILES) $(DESKTOP_FILES_IN_H)
rm -rf build $(LOCALEDIR)
distclean: clean
rm -rf dist
##########################################################################
.PHONY: help unittest release releasetest install manpages clean distclean messages headlink lint revbump
##########################################################################