-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathmakefile
More file actions
115 lines (84 loc) · 4.46 KB
/
makefile
File metadata and controls
115 lines (84 loc) · 4.46 KB
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
PBUILDER_PKG = pbuilder-satisfydepends-dummy
GOPKG_PREFIX = github.com/linuxdeepin/lastore-daemon
GOPATH_DIR = gopath
pwd := ${shell pwd}
GoPath := GOPATH=${pwd}:${pwd}/vendor:${CURDIR}/${GOPATH_DIR}:${GOPATH}
GOBUILD = go build
GOTEST = go test
export GO111MODULE=off
all: build
TEST = $(shell find src -name '*_test.go' -exec dirname {} \; | sort -u | sed 's|^|${GOPKG_PREFIX}/|')
prepare:
@mkdir -p out/bin
@mkdir -p ${GOPATH_DIR}/src/$(dir ${GOPKG_PREFIX});
@ln -snf ../../../.. ${GOPATH_DIR}/src/${GOPKG_PREFIX};
bin/lastore-agent:src/lastore-agent/*.c
@mkdir -p bin
gcc ${SECURITY_BUILD_OPTIONS} -W -Wall -D_GNU_SOURCE -o $@ $^ $(shell pkg-config --cflags --libs glib-2.0 libsystemd)
bin/lastore-upgrade-query: src/lastore-upgrade-query/*.cc
@mkdir -p bin
g++ ${SECURITY_BUILD_OPTIONS} -W -Wall -o $@ $^ $(shell pkg-config --cflags --libs apt-pkg) $(shell pkg-config --cflags --libs nlohmann_json)
build: prepare bin/lastore-agent bin/lastore-upgrade-query
${GoPath} ${GOBUILD_CGO_FLAGS} ${GOBUILD} -o bin/lastore-daemon ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/src/lastore-daemon
${GoPath} ${GOBUILD_CGO_FLAGS} ${GOBUILD} -o bin/lastore-tools ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/src/lastore-tools
${GoPath} ${GOBUILD_CGO_FLAGS} ${GOBUILD} -o bin/lastore-smartmirror ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/src/lastore-smartmirror || echo "build failed, disable smartmirror support "
${GoPath} ${GOBUILD_CGO_FLAGS} ${GOBUILD} -o bin/lastore-smartmirror-daemon ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/src/lastore-smartmirror-daemon || echo "build failed, disable smartmirror support "
${GoPath} ${GOBUILD_CGO_FLAGS} ${GOBUILD} -o bin/lastore-apt-clean ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/src/lastore-apt-clean
dev-tools: bin/iup-tool
bin/iup-tool:
${GoPath} ${GOBUILD_CGO_FLAGS} ${GOBUILD} -o bin/iup-tool ${GOBUILD_OPTIONS} ${GOPKG_PREFIX}/src/dev-tools/iup-tool
fetch-base-metadata:
./bin/lastore-tools update -r desktop -j applications -o var/lib/lastore/applications.json
./bin/lastore-tools update -r desktop -j categories -o var/lib/lastore/categories.json
./bin/lastore-tools update -r desktop -j mirrors -o var/lib/lastore/mirrors.json
test:
NO_TEST_NETWORK=$(shell \
if which dpkg >/dev/null;then \
if dpkg -s ${PBUILDER_PKG} 2>/dev/null|grep 'Status:.*installed' >/dev/null;then \
echo 1; \
fi; \
fi) \
${GoPath} ${GOTEST} ${TEST} -count=1 -v
test-coverage:
env ${GoPath} go test -cover -v ./src/... | awk '$$1 ~ "^(ok|\\?)" {print $$2","$$5}' | sed "s:${CURDIR}::g" | sed 's/files\]/0\.0%/g' > coverage.csv
print_gopath:
GOPATH="${pwd}:${pwd}/vendor:${GOPATH}"
install: gen_mo
mkdir -p ${DESTDIR}${PREFIX}/usr/bin && cp bin/lastore-apt-clean ${DESTDIR}${PREFIX}/usr/bin/
cp bin/lastore-tools ${DESTDIR}${PREFIX}/usr/bin/
cp bin/lastore-smartmirror ${DESTDIR}${PREFIX}/usr/bin/
cp bin/lastore-agent ${DESTDIR}${PREFIX}/usr/bin/
cp bin/lastore-upgrade-query ${DESTDIR}${PREFIX}/usr/bin/
mkdir -p ${DESTDIR}${PREFIX}/usr/libexec/lastore-daemon && cp bin/lastore-daemon ${DESTDIR}${PREFIX}/usr/libexec/lastore-daemon
cp bin/lastore-smartmirror-daemon ${DESTDIR}${PREFIX}/usr/libexec/lastore-daemon
mkdir -p ${DESTDIR}${PREFIX}/usr && cp -rf usr ${DESTDIR}${PREFIX}/
cp -rf etc ${DESTDIR}${PREFIX}/
mkdir -p ${DESTDIR}${PREFIX}/var/lib/lastore/
cp -rf var/lib/lastore/* ${DESTDIR}${PREFIX}/var/lib/lastore/
cp -rf lib ${DESTDIR}${PREFIX}/
mkdir -p ${DESTDIR}${PREFIX}/var/cache/lastore
mkdir -p ${DESTDIR}${PREFIX}/var/lib/lastore/check/
cp -rf configs/config.yaml ${DESTDIR}${PREFIX}/var/lib/lastore/check/config.yaml
cp -rf configs/caches.yaml ${DESTDIR}${PREFIX}/var/lib/lastore/check/caches.yaml
update_pot:
deepin-update-pot locale/locale_config.ini
gen_mo:
deepin-generate-mo locale/locale_config.ini
mkdir -p ${DESTDIR}${PREFIX}/usr/share/locale/
cp -rf locale/mo/* ${DESTDIR}${PREFIX}/usr/share/locale/
deepin-generate-mo locale_categories/locale_config.ini
cp -rf locale_categories/mo/* ${DESTDIR}${PREFIX}/usr/share/locale/
gen-xml:
qdbus --system org.deepin.dde.Lastore1 /org/deepin/dde/Lastore1 org.freedesktop.DBus.Introspectable.Introspect > usr/share/dbus-1/interfaces/org.deepin.dde.Lastore1.xml
qdbus --system org.deepin.dde.Lastore1 /org/deepin/dde/Lastore1/Job1 org.freedesktop.DBus.Introspectable.Introspect > usr/share/dbus-1/interfaces/org.deepin.dde.Lastore1.Job.xml
build-deb:
yes | debuild -us -uc
clean:
rm -rf bin
rm -rf pkg
rm -rf vendor/pkg
rm -rf vendor/bin
rm -rf gopath
check_code_quality:
${GoPath} go vet ./src/...
.PHONY: dev-tools bin/iup-tool