-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
178 lines (148 loc) · 5.67 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
PREFIX = /usr
GOBUILD_DIR = gobuild
GOPKG_PREFIX = github.com/linuxdeepin/dde-api
GOSITE_DIR = ${PREFIX}/share/gocode
libdir = /lib
SYSTEMD_LIB_DIR = ${libdir}
SYSTEMD_SERVICE_DIR = ${SYSTEMD_LIB_DIR}/systemd/system/
GOBUILD = env GOPATH="${CURDIR}/${GOBUILD_DIR}:${GOPATH}" go build
TESTS = \
${GOPKG_PREFIX}/adjust-grub-theme \
${GOPKG_PREFIX}/blurimage \
${GOPKG_PREFIX}/cursor-helper \
${GOPKG_PREFIX}/dde-open \
${GOPKG_PREFIX}/deepin-shutdown-sound \
${GOPKG_PREFIX}/device \
${GOPKG_PREFIX}/drandr \
${GOPKG_PREFIX}/dxinput \
${GOPKG_PREFIX}/dxinput/common \
${GOPKG_PREFIX}/dxinput/kwayland \
${GOPKG_PREFIX}/dxinput/utils \
${GOPKG_PREFIX}/graphic \
${GOPKG_PREFIX}/grub_theme/font \
${GOPKG_PREFIX}/grub_theme/themetxt \
${GOPKG_PREFIX}/gtk-thumbnailer \
${GOPKG_PREFIX}/hans2pinyin \
${GOPKG_PREFIX}/huangli \
${GOPKG_PREFIX}/huangli-generator \
${GOPKG_PREFIX}/i18n_dependent \
${GOPKG_PREFIX}/image-blur \
${GOPKG_PREFIX}/image-blur-helper \
${GOPKG_PREFIX}/inhibit_hint \
${GOPKG_PREFIX}/lang_info \
${GOPKG_PREFIX}/language_support \
${GOPKG_PREFIX}/locale-helper \
${GOPKG_PREFIX}/lunar-calendar \
${GOPKG_PREFIX}/polkit \
${GOPKG_PREFIX}/powersupply \
${GOPKG_PREFIX}/powersupply/battery \
${GOPKG_PREFIX}/session \
${GOPKG_PREFIX}/sound-theme-player \
${GOPKG_PREFIX}/soundutils \
${GOPKG_PREFIX}/theme_thumb \
${GOPKG_PREFIX}/theme_thumb/common \
${GOPKG_PREFIX}/theme_thumb/cursor \
${GOPKG_PREFIX}/theme_thumb/gtk \
${GOPKG_PREFIX}/theme_thumb/icon \
${GOPKG_PREFIX}/themes \
${GOPKG_PREFIX}/themes/scanner \
${GOPKG_PREFIX}/thumbnailer \
${GOPKG_PREFIX}/thumbnails \
${GOPKG_PREFIX}/thumbnails/cursor \
${GOPKG_PREFIX}/thumbnails/font \
${GOPKG_PREFIX}/thumbnails/gtk \
${GOPKG_PREFIX}/thumbnails/icon \
${GOPKG_PREFIX}/thumbnails/images \
${GOPKG_PREFIX}/thumbnails/loader \
${GOPKG_PREFIX}/thumbnails/pdf \
${GOPKG_PREFIX}/thumbnails/text \
${GOPKG_PREFIX}/userenv \
${GOPKG_PREFIX}/validator
LIBRARIES = \
thumbnails \
themes \
theme_thumb\
dxinput \
drandr \
soundutils \
lang_info \
i18n_dependent \
session \
language_support \
userenv \
inhibit_hint \
powersupply \
polkit \
ININSTALLS = \
${LIBRARIES} \
go.sum \
go.mod
BINARIES = \
device \
graphic \
locale-helper \
thumbnailer \
hans2pinyin \
cursor-helper \
gtk-thumbnailer \
sound-theme-player \
deepin-shutdown-sound \
dde-open \
adjust-grub-theme \
image-blur \
image-blur-helper
#lunar-calendar \
all: build-binary build-dev ts-to-policy
prepare:
@mkdir -p ${GOBUILD_DIR}/src/$(dir ${GOPKG_PREFIX});
@ln -snf ../../../.. ${GOBUILD_DIR}/src/${GOPKG_PREFIX};
ts:
deepin-policy-ts-convert policy2ts misc/polkit-action/org.deepin.dde.locale-helper.policy.in misc/ts/org.deepin.dde.locale-helper.policy
deepin-policy-ts-convert policy2ts misc/polkit-action/org.deepin.dde.device.unblock-bluetooth-devices.policy.in misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy
ts-to-policy:
deepin-policy-ts-convert ts2policy misc/polkit-action/org.deepin.dde.locale-helper.policy.in misc/ts/org.deepin.dde.locale-helper.policy misc/polkit-action/org.deepin.dde.locale-helper.policy
deepin-policy-ts-convert ts2policy misc/polkit-action/org.deepin.dde.device.unblock-bluetooth-devices.policy.in misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy misc/polkit-action/org.deepin.dde.device.unblock-bluetooth-devices.policy
out/bin/%:
${GOBUILD} -o $@ ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/${@F}
build-binary: prepare $(addprefix out/bin/, ${BINARIES})
install-binary:
mkdir -pv ${DESTDIR}${PREFIX}${libdir}/deepin-api
cp out/bin/* ${DESTDIR}${PREFIX}${libdir}/deepin-api/
cp misc/scripts/* ${DESTDIR}${PREFIX}${libdir}/deepin-api/
mkdir -pv ${DESTDIR}${PREFIX}/bin
cp out/bin/dde-open ${DESTDIR}${PREFIX}/bin
rm ${DESTDIR}${PREFIX}${libdir}/deepin-api/dde-open
mkdir -pv ${DESTDIR}${PREFIX}/share/dbus-1/system.d
cp misc/conf/*.conf ${DESTDIR}${PREFIX}/share/dbus-1/system.d/
mkdir -pv ${DESTDIR}${PREFIX}/share/dbus-1/services
cp -v misc/services/*.service ${DESTDIR}${PREFIX}/share/dbus-1/services/
mkdir -pv ${DESTDIR}${PREFIX}/share/dbus-1/system-services
cp -v misc/system-services/*.service ${DESTDIR}${PREFIX}/share/dbus-1/system-services/
mkdir -pv ${DESTDIR}${PREFIX}/share/polkit-1/actions
cp misc/polkit-action/*.policy ${DESTDIR}${PREFIX}/share/polkit-1/actions/
mkdir -pv ${DESTDIR}/var/lib/polkit-1/localauthority/10-vendor.d
cp misc/polkit-localauthority/*.pkla ${DESTDIR}/var/lib/polkit-1/localauthority/10-vendor.d/
mkdir -pv ${DESTDIR}${PREFIX}/share/dde-api
cp -R misc/data ${DESTDIR}${PREFIX}/share/dde-api
mkdir -pv ${DESTDIR}${SYSTEMD_SERVICE_DIR}
cp -R misc/systemd/system/*.service ${DESTDIR}${SYSTEMD_SERVICE_DIR}
mkdir -pv ${DESTDIR}${PREFIX}/share/icons/hicolor
cp -R misc/icons/* ${DESTDIR}${PREFIX}/share/icons/hicolor
build-dev: prepare
${GOBUILD} $(addprefix ${GOPKG_PREFIX}/, ${LIBRARIES})
install/lib/%:
mkdir -pv ${DESTDIR}${GOSITE_DIR}/src/${GOPKG_PREFIX}
cp -R ${CURDIR}/${GOBUILD_DIR}/src/${GOPKG_PREFIX}/${@F} ${DESTDIR}${GOSITE_DIR}/src/${GOPKG_PREFIX}
install-dev: ${addprefix install/lib/, ${ININSTALLS}}
install: install-binary install-dev
clean:
rm -rf out/bin gobuild out
rebuild: clean build
check_code_quality: prepare
env GOPATH="${CURDIR}/${GOBUILD_DIR}:${GOPATH}" go vet ./...
test: prepare
env GOPATH="${CURDIR}/${GOBUILD_DIR}:${GOPATH}" go test -v ${TESTS}
print_gopath: prepare
GOPATH="${CURDIR}/${GOBUILD_DIR}:${GOPATH}"
test-coverage: prepare
env GOPATH="${CURDIR}/${GOBUILD_DIR}:${GOPATH}" go test -cover -v ./... | awk '$$1 ~ "^(ok|\\?)" {print $$2","$$5}' | sed "s:${CURDIR}::g" | sed 's/files\]/0\.0%/g' > coverage.csv