-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
164 lines (120 loc) · 4.64 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 mod-panel #
# ---------------------- #
# Created by falkTX
#
# ----------------------------------------------------------------------------------------------------------------------------
PREFIX := /usr
DESTDIR :=
# ----------------------------------------------------------------------------------------------------------------------------
# Set PyQt tools
# TODO use shell to check for tool
# TODO also check for virtualenv
PYUIC5 ?= $(shell which pyuic5 2>/dev/null)
PYUIC6 ?= $(shell which pyuic6 2>/dev/null)
ifneq (,$(wildcard $(PYUIC5)))
HAVE_PYQT=true
HAVE_PYQT5=true
else
HAVE_PYQT5=false
endif
ifneq (,$(wildcard $(PYUIC6)))
HAVE_PYQT=true
HAVE_PYQT6=true
else
HAVE_PYQT6=false
endif
ifneq ($(HAVE_PYQT),true)
$(error PyQt is not available, please install it)
endif
ifeq ($(HAVE_PYQT5),true)
DEFAULT_QT ?= 5
else
DEFAULT_QT ?= 6
endif
ifeq ($(DEFAULT_QT),5)
PYUIC ?= pyuic5
PYRCC ?= pyrcc5
else
PYUIC ?= pyuic6
PYRCC ?= pyrcc6
endif
# ----------------------------------------------------------------------------------------------------------------------------
all: RES UI host ui_utils sdk_utils
# ----------------------------------------------------------------------------------------------------------------------------
# Resources
RES = \
source/mod_config.py \
source/resources_rc.py
RES: $(RES)
source/mod_config.py:
@echo "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n" > $@
ifeq ($(DEFAULT_QT),5)
@echo "config_UseQt5 = True" >> $@
else
@echo "config_UseQt5 = False" >> $@
endif
source/resources_rc.py: resources/resources.qrc resources/*/*.svg
$(PYRCC) $< -o $@
bin/resources/%.py: source/%.py
$(LINK) $(CURDIR)/source/$*.py bin/resources/
# ----------------------------------------------------------------------------------------------------------------------------
# UI code
UIs = \
source/ui_mod_panel.py
UI: $(UIs)
source/ui_%.py: resources/ui/%.ui
$(PYUIC) $< -o $@
# ----------------------------------------------------------------------------------------------------------------------------
# host (from mod-host submodule)
host: source/mod-host/mod-host
source/mod-host/mod-host: source/mod-host/src/*.c source/mod-host/src/*.h
$(MAKE) -C source/mod-host
# ----------------------------------------------------------------------------------------------------------------------------
# utils (from mod-ui submodule)
ui_utils: source/mod-ui/utils/libmod_utils.so
source/mod-ui/utils/libmod_utils.so: source/mod-ui/utils/*.cpp source/mod-ui/utils/*.h
$(MAKE) -C source/mod-ui/utils
# ----------------------------------------------------------------------------------------------------------------------------
# utils (from mod-sdk submodule)
sdk_utils: source/mod-sdk/utils/libmod_utils.so
source/mod-sdk/utils/libmod_utils.so: source/mod-sdk/utils/*.cpp source/mod-sdk/utils/*.h
$(MAKE) -C source/mod-sdk/utils
# ----------------------------------------------------------------------------------------------------------------------------
run: all
./source/mod-panel
# ----------------------------------------------------------------------------------------------------------------------------
clean:
rm -f $(RES) $(UIs)
rm -f *~ source/*~ source/*.pyc source/*_rc.py source/ui_*.py
$(MAKE) clean -C source/mod-host
$(MAKE) clean -C source/mod-ui/utils
$(MAKE) clean -C source/mod-sdk/utils
# ----------------------------------------------------------------------------------------------------------------------------
not_install:
# Create directories
install -d $(DESTDIR)$(PREFIX)/bin/
install -d $(DESTDIR)$(PREFIX)/share/applications/
install -d $(DESTDIR)$(PREFIX)/share/mod-panel/
install -d $(DESTDIR)$(PREFIX)/share/pixmaps/
# Install desktop file and pixmap
install -m 755 data/*.desktop $(DESTDIR)$(PREFIX)/share/applications/
install -m 644 resources/48x48/mod.png $(DESTDIR)$(PREFIX)/share/pixmaps/mod-panel.svg
# Install script files
install -m 755 \
data/mod-panel \
$(DESTDIR)$(PREFIX)/bin/
# Install python code
install -m 644 \
source/mod-panel \
source/*.py \
$(DESTDIR)$(PREFIX)/share/mod-panel/
# Adjust PREFIX value in script files
sed -i "s?X-PREFIX-X?$(PREFIX)?" $(DESTDIR)$(PREFIX)/bin/mod-panel
# ----------------------------------------------------------------------------------------------------------------------------
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/mod-panel
rm -f $(DESTDIR)$(PREFIX)/share/applications/mod-panel.desktop
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/mod-panel.svg
rm -rf $(DESTDIR)$(PREFIX)/share/mod-panel/
# ----------------------------------------------------------------------------------------------------------------------------