Debian Codegraph @

Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 PYTHON3_CMD ?= python3
2 PYTEST ?= py.test-3
3 BLACK ?= black
4
5 PREFIX = /usr/local
6 EPREFIX = $(PREFIX)
7
8 LIBINSTALLDIR = $(EPREFIX)/lib
9 DATADIR = $(PREFIX)/share
10 MANPREFIX = $(PREFIX)/share
11 # /etc if PREFIX is /usr, $PREFIX/etc otherwise.
12 ETCDIR := $(shell [ "$(PREFIX)" = "/usr" ] && echo /etc || echo "$(PREFIX)/etc")
13 XDGCONFDIR = $(ETCDIR)/xdg
14
15 # Find bash-completion's completions directory, first by checking pkg-config,
16 # then using a hard-coded path. Override BASHCOMPDIR if it's still wrong for
17 # your OS.
18 BASHCOMPDIR := $(shell pkg-config --define-variable=prefix="$(PREFIX)" \
19 --variable=completionsdir bash-completion 2> /dev/null \
20 || echo "$(PREFIX)/share/bash-completion/completions")
21
22 # Like above but for Fish.
23 FISHCOMPDIR := $(shell pkg-config \
24 --variable=completionsdir fish 2> /dev/null \
25 || echo "$(PREFIX)/share/fish/vendor_completions.d")
26
27 EXAILEBINDIR = $(DESTDIR)$(EPREFIX)/bin
28 EXAILELIBDIR = $(DESTDIR)$(LIBINSTALLDIR)/exaile
29 EXAILESHAREDIR = $(DESTDIR)$(DATADIR)/exaile
30 EXAILECONFDIR = $(DESTDIR)$(XDGCONFDIR)/exaile
31 EXAILEMANDIR = $(DESTDIR)$(MANPREFIX)/man
32
33 .PHONY: all all_no_locale builddir compile make-install-dirs uninstall \
34 install install_no_locale install-target locale install-locale \
35 plugins-dist manpage completion clean pot potball dist check-doc test \
36 test_coverage lint_errors sanitycheck format
37
38 all: compile completion locale manpage desktop_files
39 @echo "Ready to install..."
40
41 # The no_locale stuff is by request of BSD people, please ensure
42 # all methods that deal with locale stuff have a no_locale variant
43 all_no_locale: compile completion manpage desktop_files_no_locale
44 @echo "Ready to install..."
45
46 builddir:
47 mkdir -p build
48
49 compile:
50 $(PYTHON3_CMD) -m compileall -q xl xlgui
51 $(PYTHON3_CMD) -O -m compileall -q xl xlgui
52 $(MAKE) -C plugins compile
53
54 make-install-dirs:
55 install -d -m 755 $(EXAILEBINDIR)
56 install -d -m 755 $(EXAILELIBDIR)
•57 find xl xlgui -type d -not '(' -path "*__pycache__" ')' -exec install -d -m 755 $(EXAILELIBDIR)/'{}' ';'
58 install -d -m 755 $(EXAILESHAREDIR)
59 install -d -m 755 $(EXAILESHAREDIR)/data
60 install -d -m 755 $(EXAILESHAREDIR)/data/images/16x16
61 install -d -m 755 $(EXAILESHAREDIR)/data/images/22x22
62 install -d -m 755 $(EXAILESHAREDIR)/data/images/24x24
63 install -d -m 755 $(EXAILESHAREDIR)/data/images/32x32
64 install -d -m 755 $(EXAILESHAREDIR)/data/images/48x48
65 install -d -m 755 $(EXAILESHAREDIR)/data/images/128x128
66 install -d -m 755 $(EXAILESHAREDIR)/data/images/scalable
67 install -d -m 755 $(EXAILESHAREDIR)/data/ui
68 find data/ui -type d -exec install -d -m 755 $(EXAILESHAREDIR)/'{}' ';'
69 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/16x16/apps/
70 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/22x22/apps/
71 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps/
72 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/32x32/apps/
73 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps/
74 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/128x128/apps/
75 install -d -m 755 $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps/
76 install -d -m 755 $(DESTDIR)$(DATADIR)/metainfo
77 install -d -m 755 $(DESTDIR)$(DATADIR)/applications
78 install -d -m 755 $(DESTDIR)$(DATADIR)/dbus-1/services
79 install -d -m 755 $(EXAILEMANDIR)/man1
80 install -d -m 755 $(DESTDIR)$(BASHCOMPDIR)
81 install -d -m 755 $(DESTDIR)$(FISHCOMPDIR)
82 install -d -m 755 $(EXAILECONFDIR)
83
84 uninstall:
85 rm -f $(EXAILEBINDIR)/exaile
86 rm -rf $(EXAILELIBDIR)
87 rm -rf $(EXAILESHAREDIR)
88 rm -rf $(EXAILECONFDIR)
89 rm -f $(DESTDIR)$(DATADIR)/applications/exaile.desktop
90 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/16x16/apps/exaile.png
91 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/22x22/apps/exaile.png
92 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps/exaile.png
93 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/32x32/apps/exaile.png
94 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps/exaile.png
95 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/128x128/apps/exaile.png
96 rm -f $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps/exaile.svg
97 rm -f $(DESTDIR)$(DATADIR)/appdata/exaile.appdata.xml
98 rm -f $(DESTDIR)$(DATADIR)/dbus-1/services/org.exaile.Exaile.service
99 rm -f $(EXAILEMANDIR)/man1/exaile.1.gz
100 rm -f $(DESTDIR)$(BASHCOMPDIR)/exaile
101 rm -f $(DESTDIR)$(FISHCOMPDIR)/exaile.fish
102 $(MAKE) -C plugins uninstall
103 find $(DESTDIR)$(DATADIR)/locale -name "exaile.mo" -exec rm -f {} \;
104
105 # List a *.mo file for any *.po file
106 LOCALE_SRCS=$(wildcard po/*.po)
107 LOCALE_OBJS=$(LOCALE_SRCS:.po=.mo)
108 LINGUAS=$(sort $(patsubst po/%.po,%,$(LOCALE_SRCS)))
109
110 install: install-target install-locale
111
112 install_no_locale: install-target
113
114 install-target: make-install-dirs
115 install -p -m 644 exaile.py $(EXAILELIBDIR)
•116 find xl xlgui '(' -name '*.py' ')' -exec install -p -m 644 '{}' $(EXAILELIBDIR)/'{}' ';'
117 find data/images '(' -name '*.png' -o -name '*.svg' ')' -exec install -p -m 644 '{}' $(EXAILESHAREDIR)/'{}' ';'
118 install -p -m 644 data/images/16x16/exaile.png \
119 $(DESTDIR)$(DATADIR)/icons/hicolor/16x16/apps/exaile.png
120 install -p -m 644 data/images/22x22/exaile.png \
121 $(DESTDIR)$(DATADIR)/icons/hicolor/22x22/apps/exaile.png
122 install -p -m 644 data/images/24x24/exaile.png \
123 $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps/exaile.png
124 install -p -m 644 data/images/32x32/exaile.png \
125 $(DESTDIR)$(DATADIR)/icons/hicolor/32x32/apps/exaile.png
126 install -p -m 644 data/images/48x48/exaile.png \
127 $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps/exaile.png
128 install -p -m 644 data/images/128x128/exaile.png \
129 $(DESTDIR)$(DATADIR)/icons/hicolor/128x128/apps/exaile.png
130 install -p -m 644 data/images/scalable/exaile.svg \
131 $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps/exaile.svg
132 find data/ui -name '*.ui' -exec install -p -m 644 '{}' $(EXAILESHAREDIR)/'{}' ';'
133 -install -p -m 644 build/exaile.desktop $(DESTDIR)$(DATADIR)/applications/
134 -install -p -m 644 build/org.exaile.exaile.appdata.xml $(DESTDIR)$(DATADIR)/metainfo/
135 -install -p -m 644 build/exaile.1.gz $(EXAILEMANDIR)/man1/
136 -install -p -m 644 build/exaile.bash-completion $(DESTDIR)$(BASHCOMPDIR)/exaile
137 -install -p -m 644 build/exaile.fish-completion $(DESTDIR)$(FISHCOMPDIR)/exaile.fish
138 install -p -m 644 data/config/settings.ini $(EXAILECONFDIR)
139 tools/generate-launcher "$(DESTDIR)" "$(PREFIX)" "$(EPREFIX)" "$(LIBINSTALLDIR)" \
140 "$(PYTHON3_CMD)" && \
141 chmod 755 $(EXAILEBINDIR)/exaile
142 sed "s|\@bindir\@|$(EPREFIX)/bin|" data/org.exaile.Exaile.service.in > \
143 $(DESTDIR)$(DATADIR)/dbus-1/services/org.exaile.Exaile.service && \
144 chmod 644 $(DESTDIR)$(DATADIR)/dbus-1/services/org.exaile.Exaile.service
145 if [ -d ".git" ]; then \
146 sed "s|__version__ = \"devel\"|__version__ = \"$(shell git describe --tags --abbrev=0)\"|" \
147 xl/version.py > $(EXAILELIBDIR)/xl/version.py; \
148 fi
149 $(MAKE) -C plugins install
150
•151 %.mo: %.po
152 $(eval LOCALE_DIR := `echo $< | sed "s|^po/|build/locale/|" | sed "s|.po|/LC_MESSAGES|"`)
153 mkdir -p $(LOCALE_DIR)
154 -msgmerge -q -o - $< po/messages.pot | msgfmt -c -o $(LOCALE_DIR)/exaile.mo -
155
156 locale: $(LOCALE_OBJS)
157
158 install-locale:
159 for f in `find build/locale -name exaile.mo` ; do \
160 install -d -m 755 \
161 `echo $$f | sed "s|^build|$(DESTDIR)$(DATADIR)|" | \
162 xargs dirname` && \
163 install -p -m 644 $$f \
164 `echo $$f | sed "s|^build|$(DESTDIR)$(DATADIR)|"` ; \
165 done
166
167
168 plugins_dist:
169 $(MAKE) -C plugins dist
170
171 manpage: builddir
172 LC_ALL=C help2man -n "music manager and player" -N ./exaile \
173 | gzip -9 > build/exaile.1.gz
174
175 completion: builddir
176 $(PYTHON3_CMD) tools/generate-completion.py bash > build/exaile.bash-completion
177 $(PYTHON3_CMD) tools/generate-completion.py fish > build/exaile.fish-completion
178
179 clean:
180 -find . -name "*.~[0-9]~" -exec rm -f {} \;
181 -find . -name "__pycache__" -exec rm -rf {} \;
182 rm -rf build/
183 $(MAKE) -C plugins clean
184 -$(MAKE) -C doc clean
185 # for older versions of this Makefile:
186 find po/* -depth -type d -exec rm -r {} \;
187 if [ -f po/LINGUAS ]; then rm po/LINGUAS; fi
188
189 po/messages.pot: pot
190
191 # The "set -o pipefail" makes the whole thing die if any of the find fails.
192 # dash (Debian's /bin/sh) doesn't support it and exits immediately, so we test it in a subshell.
193 # The "export LC_ALL=C" disables any locale-dependent sort behavior.
194 pot:
195 ( ( set -o pipefail 2> /dev/null ) && set -o pipefail ; \
196 export LC_ALL=C && cd po && \
197 { find ../xl ../xlgui -name "*.py" | sort && \
198 find ../data/ui -name "*.ui" | sort && \
199 find ../plugins -name "*.py" | sort && \
200 find ../plugins -name "*.ui" | sort ; } \
201 | xgettext --files-from=- --output=messages.pot --from-code=UTF-8 --add-comments=TRANSLATORS --keyword=N_ && \
202 find ../plugins -name PLUGININFO | sort \
203 | xgettext --files-from=- --output=messages.pot --from-code=UTF-8 --add-comments=TRANSLATORS --join-existing --language=Python && \
204 xgettext -j -o messages.pot --keyword=X-GNOME-FullName '../data/exaile.desktop.in' && \
205 xgettext -j -o messages.pot '../data/exaile.appdata.xml.in' )
206 find po -name '*.po' -exec \
207 msgmerge --previous --no-fuzzy-matching --update {} po/messages.pot \;
208
209 potball: builddir
210 tar --bzip2 --format=posix -cf build/exaile-po.tar.bz2 po/ \
211 --transform s/po/./
212
213 dist:
214 mkdir -p dist
215 rm -rf dist/copy
216 git archive HEAD --prefix=copy/ | tar -x -C dist
217 ./tools/dist.sh
218 rm -rf dist/copy
219
220 check-doc: clean
221 $(MAKE) -C doc html
222
223 BUILD_DIR = /tmp/exaile-test-build
224 test_compile:
225 mkdir -p $(BUILD_DIR)
226 cp --recursive xl xlgui plugins tools po data Makefile exaile exaile.py $(BUILD_DIR)
227 $(MAKE) -C $(BUILD_DIR) all
228
229 test:
230 EXAILE_DIR=$(shell pwd) LC_ALL=C LANGUAGE=C PYTHONPATH=$(shell pwd):$(PYTHONPATH) $(PYTEST) tests
231
232 test_coverage:
233 rm -rf coverage/
234 rm -f .coverage
235 EXAILE_DIR=$(shell pwd) nosetests -w tests --with-coverage --cover-package=xl; \
236 mkdir -p coverage; \
237 coverage html -d coverage
238
239 lint_errors:
240 -pylint -e --rcfile tools/pylint.cfg xl xlgui 2> /dev/null
241
242 sanitycheck: lint_errors test
243
244 format:
245 $(BLACK) -S *.py plugins/ xl/ xlgui/ tests/ tools/installer/exaile.spec
246
247 check_format:
248 $(BLACK) --check --diff -S *.py plugins/ xl/ xlgui/ tests/ tools/installer/exaile.spec
249
250 desktop_files: builddir locale
251 echo $(LINGUAS) > po/LINGUAS
252 msgfmt --desktop --template=data/exaile.desktop.in -d po -o build/exaile.desktop
253 msgfmt --xml --template=data/exaile.appdata.xml.in -d po -o build/org.exaile.exaile.appdata.xml
254 rm po/LINGUAS
255
256 desktop_files_no_locale: builddir
257 cp data/exaile.desktop.in build/exaile.desktop
258 cp data/exaile.appdata.xml.in build/org.exaile.exaile.appdata.xml