2 # gPodder - A media aggregator and podcast client
3 # Copyright (c) 2005-2018 The gPodder Team
5 # gPodder is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # gPodder is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##########################################################################
23 MANPAGES
= share
/man
/man1
/gpodder
.1 share
/man
/man1
/gpo
.1
25 GPODDER_SERVICE_FILE
=share
/dbus-1
/services
/org.gpodder.service
26 GPODDER_SERVICE_FILE_IN
=$(addsuffix .in
,$(GPODDER_SERVICE_FILE
))
28 DESKTOP_FILES_IN
=$(wildcard share
/applications
/*.desktop.in
)
29 DESKTOP_FILES_IN_H
=$(patsubst %.desktop.in
,%.desktop.in.h
,$(DESKTOP_FILES_IN
))
30 DESKTOP_FILES
=$(patsubst %.desktop.in
,%.desktop
,$(DESKTOP_FILES_IN
))
32 MESSAGES
= po
/messages.pot
33 POFILES
= $(wildcard po
/*.po
)
34 LOCALEDIR
= share
/locale
35 MOFILES
= $(patsubst po
/%.po
,$(LOCALEDIR
)/%/LC_MESSAGES
/gpodder.mo
, $(POFILES
))
37 UIFILES
=$(wildcard share
/gpodder
/ui
/gtk
/*.ui
)
38 UIFILES_H
=$(subst .ui
,.ui.h
,$(UIFILES
))
39 GETTEXT_SOURCE
=$(wildcard src
/gpodder
/*.py \
40 src
/gpodder
/gtkui
/*.py \
41 src
/gpodder
/gtkui
/interface
/*.py \
42 src
/gpodder
/gtkui
/desktop
/*.py \
43 src
/gpodder
/plugins
/*.py \
44 share
/gpodder
/extensions
/*.py
)
46 GETTEXT_SOURCE
+= $(UIFILES_H
)
47 GETTEXT_SOURCE
+= $(wildcard bin
/*[^~
])
48 GETTEXT_SOURCE
+= $(DESKTOP_FILES_IN_H
)
56 PYTEST ?
= $(shell which pytest || which pytest-3
)
58 ##########################################################################
61 @cat tools
/make-help.txt
63 ##########################################################################
66 LC_ALL
=C PYTHONPATH
=src
/ $(PYTEST
) --ignore
=tests
--ignore
=src
/gpodder
/utilwin32ctypes.py
--doctest-modules src
/gpodder
/util.py src
/gpodder
/jsonconfig.py
67 LC_ALL
=C PYTHONPATH
=src
/ $(PYTEST
) tests
--ignore
=src
/gpodder
/utilwin32ctypes.py
--ignore
=src
/mygpoclient
--cov
=gpodder
69 ISORTOPTS
:= -c share src
/gpodder tools bin
/* *.py
71 pycodestyle share src
/gpodder tools bin
/* *.py
72 isort
-q
$(ISORTOPTS
) || isort
--df
$(ISORTOPTS
)
76 $(PYTHON
) setup.py sdist
78 releasetest
: unittest
$(DESKTOP_FILES
) $(POFILES
)
79 for f in
$(DESKTOP_FILES
); do desktop-file-validate
$$f; done
80 for f in
$(POFILES
); do msgfmt
--check $$f; done
82 $(GPODDER_SERVICE_FILE
): $(GPODDER_SERVICE_FILE_IN
)
83 sed
-e
's#__PREFIX__#$(PREFIX)#' $< >$@
85 %.desktop
: %.desktop.in
$(POFILES
)
86 sed
-e
's#__PREFIX__#$(PREFIX)#' $< >$@.tmp
87 intltool-merge
-d
-u po
$@.tmp
$@
90 %.desktop.in.h
: %.desktop.in
91 intltool-extract
--quiet
--type
=gettext
/ini
$<
93 install: messages
$(GPODDER_SERVICE_FILE
) $(DESKTOP_FILES
)
94 $(PYTHON
) setup.py
install --root
=$(DESTDIR
) --prefix=$(PREFIX
) --optimize
=1
96 install-win
: messages
$(GPODDER_SERVICE_FILE
) $(DESKTOP_FILES
)
97 $(PYTHON
) setup.py
install
99 ##########################################################################
102 LC_ALL
=C sed
-i
"s/\(__version__\s*=\s*'\).*'/\1$(VERSION)'/" src
/gpodder
/__init__.py
103 LC_ALL
=C sed
-i
"s/\(__date__\s*=\s*'\).*'/\1$(shell date "+%Y-
%m-
%d
")'/" src
/gpodder
/__init__.py
104 LC_ALL
=C sed
-i
"s/\(__copyright__\s*=.*2005-\)[0-9]*\(.*\)/\1$(shell date "+%Y
")\2/" src
/gpodder
/__init__.py
105 $(MAKE
) messages manpages
108 @echo
"Usage: make revbump VERSION=x.y.z"
110 ##########################################################################
112 manpages
: $(MANPAGES
)
114 share
/man
/man1
/gpodder
.1: src
/gpodder
/__init__.py
$(BINFILE
)
115 LC_ALL
=C
$(HELP2MAN
) --name
="$(shell $(PYTHON) setup.py --description)" -N
$(BINFILE
) >$@
117 share
/man
/man1
/gpo
.1: src
/gpodder
/__init__.py
118 sed
-i
's/^\.TH.*/.TH GPO "1" "$(shell LANG=en date "+%B %Y")" "gpodder $(shell $(PYTHON) setup.py --version)" "User Commands"/' $@
120 ##########################################################################
125 msgmerge
--previous
--silent
$@
$< --output-file
=$@
126 msgattrib
--set-obsolete
--ignore-file
=$< -o
$@
$@
127 msgattrib
--no-obsolete
-o
$@
$@
129 $(LOCALEDIR
)/%/LC_MESSAGES
/gpodder.mo
: po
/%.po
134 intltool-extract
--quiet
--type
=gettext
/glade
$<
136 $(MESSAGES
): $(GETTEXT_SOURCE
)
137 xgettext
--from-code
=utf-8
-LPython
-k_
:1 -kN_
:1 -kN_
:1,2 -kn_
:1,2 -o
$(MESSAGES
) $^
140 xgettext
--from-code
=utf-8
-LPython
-k_
:1 -kN_
:1 -kN_
:1,2 -kn_
:1,2 -o
$(MESSAGES
) $(GETTEXT_SOURCE
)
143 ##########################################################################
145 # This only works in a Git working commit, and assumes that the local Git
146 # HEAD has already been pushed to the main repository. It's mainly useful
147 # for the gPodder maintainer to quickly generate a commit link that can be
148 # posted online in bug trackers and mailing lists.
151 @echo http
://gpodder.org
/commit
/`git show-ref HEAD | head -c8`
153 ##########################################################################
156 $(PYTHON
) setup.py
clean
157 find src
/ '(' -name
'*.pyc' -o
-name
'*.pyo' ')' -exec
rm '{}' +
158 find src
/ -type d
-name
'__pycache__' -exec
rm -r
'{}' +
159 find share
/gpodder
/ui
/ -name
'*.ui.h' -exec
rm '{}' +
160 rm -f MANIFEST .coverage messages.mo po
/*.mo
161 rm -f
$(GPODDER_SERVICE_FILE
)
162 rm -f
$(DESKTOP_FILES
) $(DESKTOP_FILES_IN_H
)
163 rm -rf build
$(LOCALEDIR
)
168 ##########################################################################
170 .PHONY
: help unittest release releasetest
install manpages
clean distclean messages headlink lint revbump
172 ##########################################################################