forked from kamilion/customizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (97 loc) · 3.9 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
VERSION = 4.1.1 ($(GIT_VERSION))
GIT_VERSION = $(shell $(GIT) rev-parse --short HEAD || echo stable)
DESTDIR =
PREFIX = $(shell $(PYTHON)-config --prefix)
ELEVATOR = pkexec
TRDIR =$(shell $(PYTHON) -c "from PyQt4.QtCore import QLibraryInfo; \
print(QLibraryInfo.location(QLibraryInfo.TranslationsPath))")
PYTHON = python2
PYTHON_VERSION = $(shell $(PYTHON) -c "import sys; print(sys.version[:3])")
PYUIC = pyuic4
PYLUPDATE = pylupdate4 -noobsolete -verbose
LRELEASE = lrelease
RM = rm -vf
FIND = find
SED = sed
GREP = grep
INSTALL = install -v
GIT = git
XZ = xz -v
PYLINT = pylint
DPKG_BUILDPACKAGE = dpkg-buildpackage
all: clean core gui
core:
$(SED) -e 's|@VERSION@|$(VERSION)|' -e 's|@PREFIX@|$(PREFIX)|g' \
src/main.py.in > src/main.py
gui:
$(SED) -e 's|@PREFIX@|$(PREFIX)|' -e 's|@ELEVATOR@|$(ELEVATOR)|' \
data/customizer.menu.in > data/customizer.menu
$(SED) -e 's|@PREFIX@|$(PREFIX)|' -e 's|@ELEVATOR@|$(ELEVATOR)|' \
data/customizer.desktop.in > data/customizer.desktop
$(SED) 's|@PREFIX@|$(PREFIX)|' data/customizer.policy.in > \
data/customizer.policy
$(SED) -e 's|@VERSION@|$(VERSION)|' -e 's|@PREFIX@|$(PREFIX)|g' \
src/gui.py.in > src/gui.py
$(PYUIC) src/gui.ui -o src/gui_ui.py
ifneq ($(shell which $(LRELEASE)),)
$(PYLUPDATE) src/*.py -ts tr/customizer_bg_BG.ts tr/customizer_ko_KR.ts
$(LRELEASE) tr/customizer_bg_BG.ts tr/customizer_ko_KR.ts
endif
install: install-core install-gui
install-core:
$(INSTALL) -dm755 $(DESTDIR)/etc $(DESTDIR)$(PREFIX)/sbin \
$(DESTDIR)$(PREFIX)/share/customizer/lib \
$(DESTDIR)$(PREFIX)/share/customizer/actions
$(INSTALL) -m755 src/main.py $(DESTDIR)$(PREFIX)/sbin/customizer
$(INSTALL) -m644 src/lib/*.py $(DESTDIR)$(PREFIX)/share/customizer/lib/
$(INSTALL) -m644 src/actions/*.py $(DESTDIR)$(PREFIX)/share/customizer/actions/
$(INSTALL) -m644 data/customizer.conf $(DESTDIR)/etc/customizer.conf
$(INSTALL) -m644 data/exclude.list \
$(DESTDIR)$(PREFIX)/share/customizer/exclude.list
install-gui:
$(INSTALL) -dm755 $(DESTDIR)$(PREFIX)/sbin \
$(DESTDIR)$(PREFIX)/share/applications \
$(DESTDIR)$(PREFIX)/share/customizer \
$(DESTDIR)$(PREFIX)/share/menu \
$(DESTDIR)$(PREFIX)/share/polkit-1/actions
$(INSTALL) -m755 src/gui.py $(DESTDIR)$(PREFIX)/sbin/customizer-gui
$(INSTALL) -m644 src/gui_ui.py $(DESTDIR)$(PREFIX)/share/customizer/
$(INSTALL) -m644 data/customizer.desktop \
$(DESTDIR)$(PREFIX)/share/applications/customizer.desktop
$(INSTALL) -m644 data/logo.png \
$(DESTDIR)$(PREFIX)/share/customizer/logo.png
$(INSTALL) -m644 data/customizer.menu \
$(DESTDIR)$(PREFIX)/share/menu/customizer
$(INSTALL) -m644 data/customizer.policy \
$(DESTDIR)$(PREFIX)/share/polkit-1/actions/customizer.policy
ifneq ($(shell which $(LRELEASE)),)
$(INSTALL) -dm755 $(DESTDIR)$(TRDIR)/
$(INSTALL) -m644 tr/*.qm $(DESTDIR)$(TRDIR)/
endif
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/sbin/customizer
$(RM) $(DESTDIR)$(PREFIX)/sbin/customizer-gui
$(RM) $(DESTDIR)/etc/customizer.conf
$(RM) -r $(DESTDIR)$(PREFIX)/share/customizer/
$(RM) $(DESTDIR)$(PREFIX)/share/applications/customizer.desktop
$(RM) $(DESTDIR)$(PREFIX)/share/menu/customizer
$(RM) $(DESTDIR)$(PREFIX)/share/polkit-1/actions/customizer.policy
lint:
cd src && $(PYLINT) lib/* actions/*.py main.py.in | $(GREP) -v \
-e 'Line too long'
dist: clean
$(GIT) archive HEAD --prefix="customizer-$(VERSION)/" | $(XZ) > \
"customizer-$(VERSION).tar.xz"
changelog:
$(GIT) log HEAD -n 1 --pretty='%cd %an <%ae> %n%H%d'
$(GIT) log $(shell $(GIT) tag | tail -n1)..HEAD --no-merges --pretty=' * %s'
clean:
$(RM) -r $(shell $(FIND) -name '*.pyc') tr/*.qm *.tar.xz
$(RM) -r debian/*.log debian/customizer.substvars \
debian/customizer debian/files \
src/gui_ui.py src/gui.py src/main.py \
data/customizer.policy data/customizer.menu \
data/customizer.desktop
deb:
DEB_BUILD_OPTIONS=nocheck $(DPKG_BUILDPACKAGE) -us -uc -b
.PHONY: all core gui install install-core install-gui uninstall lint dist changelog clean deb