gPodder 3.7.0 for Harmattan
[gpodder.git] / makefile
blob88192b4f1a1e40306a1f33de9451b9f77be6daa1
2 # gPodder - A media aggregator and podcast client
3 # Copyright (c) 2005-2014 Thomas Perl and 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 ##########################################################################
22 BINFILE = bin/gpodder
23 MANPAGE = share/man/man1/gpodder.1
25 GPODDER_SERVICE_FILE=share/dbus-1/services/org.gpodder.service
26 GPODDER_SERVICE_FILE_IN=$(addsuffix .in,$(GPODDER_SERVICE_FILE))
28 GPODDER_DESKTOP_FILE=share/applications/gpodder.desktop
29 GPODDER_DESKTOP_FILE_TMP=$(addsuffix .tmp,$(GPODDER_DESKTOP_FILE))
30 GPODDER_DESKTOP_FILE_IN=$(addsuffix .in,$(GPODDER_DESKTOP_FILE))
31 GPODDER_DESKTOP_FILE_H=$(addsuffix .h,$(GPODDER_DESKTOP_FILE_IN))
33 MESSAGES = po/messages.pot
34 POFILES = $(wildcard po/*.po)
35 LOCALEDIR = share/locale
36 MOFILES = $(patsubst po/%.po,$(LOCALEDIR)/%/LC_MESSAGES/gpodder.mo, $(POFILES))
38 UIFILES=$(wildcard share/gpodder/ui/gtk/*.ui)
39 UIFILES_H=$(subst .ui,.ui.h,$(UIFILES))
40 QMLFILES=$(wildcard share/gpodder/ui/qml/*.qml \
41 share/gpodder/ui/qml/harmattan/org/gpodder/qmlui/*.qml \
42 share/gpodder/ui/qml/sailfish/org/gpodder/qmlui/*.qml)
43 GETTEXT_SOURCE=$(wildcard src/gpodder/*.py \
44 src/gpodder/gtkui/*.py \
45 src/gpodder/gtkui/interface/*.py \
46 src/gpodder/gtkui/desktop/*.py \
47 src/gpodder/qmlui/*.py \
48 src/gpodder/webui/*.py \
49 src/gpodder/plugins/*.py \
50 share/gpodder/extensions/*.py)
52 GETTEXT_SOURCE += $(UIFILES_H)
53 GETTEXT_SOURCE += $(QMLFILES)
54 GETTEXT_SOURCE += $(wildcard bin/*)
55 GETTEXT_SOURCE += $(GPODDER_DESKTOP_FILE_H)
57 DESTDIR ?= /
58 PREFIX ?= /usr
60 PYTHON ?= python
61 HELP2MAN ?= help2man
63 ##########################################################################
65 help:
66 @cat tools/make-help.txt
68 ##########################################################################
70 unittest:
71 LC_ALL=C PYTHONPATH=src/ $(PYTHON) -m gpodder.unittests
73 release: distclean
74 $(PYTHON) setup.py sdist
76 releasetest: unittest $(GPODDER_DESKTOP_FILE) $(POFILES)
77 desktop-file-validate $(GPODDER_DESKTOP_FILE)
78 sh tools/i18n/validate.sh
80 $(GPODDER_SERVICE_FILE): $(GPODDER_SERVICE_FILE_IN)
81 sed -e 's#__PREFIX__#$(PREFIX)#' $< >$@
83 $(GPODDER_DESKTOP_FILE): $(GPODDER_DESKTOP_FILE_IN) $(POFILES)
84 sed -e 's#__PREFIX__#$(PREFIX)#' $< >$(GPODDER_DESKTOP_FILE_TMP)
85 intltool-merge -d -u po $(GPODDER_DESKTOP_FILE_TMP) $@
86 rm -f $(GPODDER_DESKTOP_FILE_TMP)
88 $(GPODDER_DESKTOP_FILE_IN).h: $(GPODDER_DESKTOP_FILE_IN)
89 intltool-extract --quiet --type=gettext/ini $<
91 install: messages $(GPODDER_SERVICE_FILE) $(GPODDER_DESKTOP_FILE)
92 $(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) --optimize=1
94 ##########################################################################
96 manpage: $(MANPAGE)
98 $(MANPAGE): src/gpodder/__init__.py $(BINFILE)
99 LC_ALL=C $(HELP2MAN) --name="$(shell $(PYTHON) setup.py --description)" -N $(BINFILE) >$(MANPAGE)
101 ##########################################################################
103 messages: $(MOFILES)
105 %.po: $(MESSAGES)
106 msgmerge --silent $@ $< --output-file=$@
108 $(LOCALEDIR)/%/LC_MESSAGES/gpodder.mo: po/%.po
109 @mkdir -p $(@D)
110 msgfmt $< -o $@
112 %.ui.h: %.ui
113 intltool-extract --quiet --type=gettext/glade $<
115 $(MESSAGES): $(GETTEXT_SOURCE)
116 xgettext -LPython -k_:1 -kN_:1 -kN_:1,2 -kn_:1,2 -o $(MESSAGES) $^
118 ##########################################################################
120 # This only works in a Git working commit, and assumes that the local Git
121 # HEAD has already been pushed to the main repository. It's mainly useful
122 # for the gPodder maintainer to quickly generate a commit link that can be
123 # posted online in bug trackers and mailing lists.
125 headlink:
126 @echo http://gpodder.org/commit/`git show-ref HEAD | head -c8`
128 ##########################################################################
130 clean:
131 $(PYTHON) setup.py clean
132 find src/ '(' -name '*.pyc' -o -name '*.pyo' ')' -exec rm '{}' +
133 find src/ -type d -name '__pycache__' -exec rm -r '{}' +
134 find share/gpodder/ui/ -name '*.ui.h' -exec rm '{}' +
135 rm -f MANIFEST .coverage messages.mo po/*.mo
136 rm -f $(GPODDER_SERVICE_FILE)
137 rm -f $(GPODDER_DESKTOP_FILE)
138 rm -f $(GPODDER_DESKTOP_FILE_H)
139 rm -rf build $(LOCALEDIR)
141 distclean: clean
142 rm -rf dist
144 ##########################################################################
146 .PHONY: help unittest release releasetest install manpage clean distclean messages headlink
148 ##########################################################################