-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
164 lines (126 loc) · 4.16 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
#!/usr/bin/make -f
# Makefile for Patchichi #
# ---------------------- #
# Created by houston4444
#
PREFIX ?= /usr/local
DESTDIR =
DEST_PATCHICHI := $(DESTDIR)$(PREFIX)/share/patchichi
LINK = ln -s -f
LRELEASE ?= lrelease
QT_VERSION ?= 5
# if you set QT_VERSION environment variable to 6 at the make command
# it will choose the other commands QT_API, pyuic6, pylupdate6.
# You will can run patchichi directly in source without install
ifeq ($(QT_VERSION), 6)
QT_API ?= PyQt6
PYUIC ?= pyuic6
PYLUPDATE ?= pylupdate6
ifeq (, $(shell which $(LRELEASE)))
LRELEASE := lrelease-qt6
endif
else
QT_API ?= PyQt5
PYUIC ?= pyuic5
PYLUPDATE ?= pylupdate5
ifeq (, $(shell which $(LRELEASE)))
LRELEASE := lrelease-qt5
endif
endif
# neeeded for make install
BUILD_CFG_FILE := src/qt_api.py
QT_API_INST := $(shell grep ^QT_API= $(BUILD_CFG_FILE) 2>/dev/null| cut -d'=' -f2| cut -d"'" -f2)
QT_API_INST ?= PyQt5
ICON_SIZES := 16 24 32 48 64 96 128 256
PYTHON := python3
ifeq (, $(shell which $(PYTHON)))
PYTHON := python
endif
PATCHBAY_DIR=HoustonPatchbay
# ---------------------
all: PATCHBAY QT_PREPARE UI RES LOCALE
PATCHBAY:
@(cd $(PATCHBAY_DIR) && $(MAKE))
QT_PREPARE:
$(info compiling for Qt$(QT_VERSION) using $(QT_API))
$(file > $(BUILD_CFG_FILE),QT_API='$(QT_API)')
ifeq ($(QT_API), $(QT_API_INST))
else
rm -f *~ src/*~ src/*.pyc src/ui/*.py \
resources/locale/*.qm src/resources_rc.py
endif
install -d src/ui
# ---------------------
# Resources
RES: src/resources_rc.py
src/resources_rc.py: resources/resources.qrc
rcc -g python $< |sed 's/ PySide. / qtpy /' > $@
# ---------------------
# UI code
UI: $(shell \
ls resources/ui/*.ui| sed 's|\.ui$$|.py|'| sed 's|^resources/|src/|')
src/ui/%.py: resources/ui/%.ui
$(PYUIC) $< -o $@
# ------------------------
# # Translations Files
LOCALE: locale
locale: locale/patchichi_en.qm \
locale/patchichi_fr.qm \
locale/%.qm: locale/%.ts
$(LRELEASE) $< -qm $@
# -------------------------
clean:
@(cd $(PATCHBAY_DIR) && $(MAKE) $@)
rm -f *~ src/*~ src/*.pyc locale/*.qm src/resources_rc.py
rm -f -R src/ui
rm -f -R src/__pycache__ src/*/__pycache__ src/*/*/__pycache__ \
src/*/*/*/__pycache__
# -------------------------
debug:
$(MAKE) DEBUG=true
# -------------------------
install:
# # Create directories
install -d $(DESTDIR)$(PREFIX)/bin/
install -d $(DESTDIR)$(PREFIX)/share/
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
install -d $(DESTDIR)$(PREFIX)/share/applications/
install -d $(DEST_PATCHICHI)/
install -d $(DEST_PATCHICHI)/locale/
install -d $(DEST_PATCHICHI)/$(PATCHBAY_DIR)/
install -d $(DEST_PATCHICHI)/$(PATCHBAY_DIR)/locale
# # Copy Desktop Files
install -m 644 data/share/applications/*.desktop \
$(DESTDIR)$(PREFIX)/share/applications/
# # Install icons
# Install icons
for sz in $(ICON_SIZES);do \
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/$${sz}x$${sz}/apps/ ;\
install -m 644 resources/main_icon/$${sz}x$${sz}/patchichi.png \
$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${sz}x$${sz}/apps/ ;\
done
# # Install icons, scalable
install -m 644 resources/main_icon/scalable/patchichi.svg \
$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
# # Copy patchbay themes
cp -r HoustonPatchbay/themes $(DEST_PATCHICHI)/$(PATCHBAY_DIR)/
cp -r HoustonPatchbay/manual $(DEST_PATCHICHI)/$(PATCHBAY_DIR)/
cp -r HoustonPatchbay/patchbay $(DEST_PATCHICHI)/$(PATCHBAY_DIR)/
# # Install main code
cp -r src $(DEST_PATCHICHI)/
# # compile python files
$(PYTHON) -m compileall $(DEST_PATCHICHI)/src/
$(PYTHON) -m compileall $(DEST_PATCHICHI)/patchbay/
# # install local manual
# cp -r manual $(DEST_PATCHICHI)/
# # install launcher to bin
install -m 755 data/bin/patchichi $(DESTDIR)$(PREFIX)/bin/
# # Install Translations
install -m 644 locale/*.qm $(DEST_PATCHICHI)/locale/
install -m 644 $(PATCHBAY_DIR)/locale/*.qm $(DEST_PATCHICHI)/$(PATCHBAY_DIR)/locale/
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/patchichi
rm -f $(DESTDIR)$(PREFIX)/share/applications/patchichi.desktop
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/patchichi.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/patchichi.svg
rm -rf $(DEST_PATCHICHI)