]> git.proxmox.com Git - proxmox-backup.git/blame - Makefile
ui: ds/content: show spinner for backups in progress
[proxmox-backup.git] / Makefile
CommitLineData
da0e1e40 1include /usr/share/dpkg/default.mk
6285b251 2include defines.mk
de779814 3
e881b8a5 4PACKAGE := proxmox-backup
da0e1e40 5ARCH := $(DEB_BUILD_ARCH)
209bb433 6
bb5c7707 7SUBDIRS := etc www docs
13b77d10 8
6285b251
WB
9# Binaries usable by users
10USR_BIN := \
11 proxmox-backup-client \
7c4dd946 12 pxar
6285b251
WB
13
14# Binaries usable by admins
b69b8af2
TL
15USR_SBIN := \
16 proxmox-backup-manager
6285b251
WB
17
18# Binaries for services:
19SERVICE_BIN := \
20 proxmox-backup-api \
b69b8af2 21 proxmox-backup-banner \
6285b251
WB
22 proxmox-backup-proxy
23
13b77d10
WB
24ifeq ($(BUILD_MODE), release)
25CARGO_BUILD_ARGS += --release
6285b251 26COMPILEDIR := target/release
13b77d10
WB
27else
28COMPILEDIR := target/debug
29endif
30
6f0069ae
WB
31ifeq ($(valgrind), yes)
32CARGO_BUILD_ARGS += --features valgrind
33endif
34
da0e1e40
FG
35CARGO ?= cargo
36
6285b251
WB
37COMPILED_BINS := \
38 $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
39
1f6a4f58
TL
40export DEB_VERSION DEB_VERSION_UPSTREAM
41
10426c17
DM
42SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb
43CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb
da0e1e40 44DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb
36d74cd6 45
10426c17
DM
46DEBS=${SERVER_DEB} ${CLIENT_DEB}
47
e881b8a5 48DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc
209bb433
DM
49
50DESTDIR=
de779814 51
13b77d10
WB
52all: cargo-build $(SUBDIRS)
53
54.PHONY: $(SUBDIRS)
55$(SUBDIRS):
56 $(MAKE) -C $@
de779814 57
cd3b9a06 58test:
cc119edb 59 #cargo test test_broadcast_future
3dceb9b3 60 #cargo test $(CARGO_BUILD_ARGS)
da0e1e40 61 $(CARGO) test $(tests) $(CARGO_BUILD_ARGS)
f7dd683b 62
cd3b9a06 63doc:
da0e1e40 64 $(CARGO) doc --no-deps $(CARGO_BUILD_ARGS)
d78345bc 65
13b77d10
WB
66# always re-create this dir
67.PHONY: build
68build:
de779814 69 rm -rf build
e881b8a5
FG
70 debcargo package --config debian/debcargo.toml --changelog-ready --no-overlay-write-back --directory build proxmox-backup $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
71 sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src
72 cat build/debian/control.src build/debian/control.in > build/debian/control
73 rm build/debian/control.in build/debian/control.src
74 rm build/Cargo.lock
75 find build/debian -name "*.hint" -delete
b369f720
WB
76 $(foreach i,$(SUBDIRS), \
77 $(MAKE) -C build/$(i) clean ;)
de779814 78
e881b8a5 79
720776b8
DM
80.PHONY: proxmox-backup-docs
81proxmox-backup-docs: $(DOC_DEB)
82$(DOC_DEB): build
83 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
84 lintian $(DOC_DEB)
85
da0e1e40 86# copy the local target/ dir as a build-cache
13b77d10 87.PHONY: deb
36d74cd6
DM
88deb: $(DEBS)
89$(DEBS): build
720776b8 90 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
36d74cd6 91 lintian $(DEBS)
18fad344
WB
92
93.PHONY: dsc
94dsc: $(DSC)
95$(DSC): build
96 cd build; dpkg-buildpackage -S -us -uc -d -nc
97 lintian $(DSC)
de779814 98
209bb433 99distclean: clean
de779814
DM
100
101clean:
b369f720
WB
102 $(foreach i,$(SUBDIRS), \
103 $(MAKE) -C $(i) clean ;)
da0e1e40 104 $(CARGO) clean
1a9cb80c 105 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build
d3cb69c4
DM
106 find . -name '*~' -exec rm {} ';'
107
209bb433 108.PHONY: dinstall
36d74cd6
DM
109dinstall: ${DEBS}
110 dpkg -i ${DEBS}
6285b251 111
bb5c7707
DM
112# make sure we build binaries before docs
113docs: cargo-build
114
13b77d10 115.PHONY: cargo-build
cd3b9a06 116cargo-build:
da0e1e40 117 $(CARGO) build $(CARGO_BUILD_ARGS)
6285b251 118
13b77d10 119$(COMPILED_BINS): cargo-build
6285b251 120
d1596102
WB
121.PHONY: lint
122lint:
123 cargo clippy -- -A clippy::all -D clippy::correctness
124
6285b251
WB
125install: $(COMPILED_BINS)
126 install -dm755 $(DESTDIR)$(BINDIR)
6dea60aa 127 install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST)
6285b251 128 $(foreach i,$(USR_BIN), \
6dea60aa
CE
129 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \
130 install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
6285b251
WB
131 install -dm755 $(DESTDIR)$(SBINDIR)
132 $(foreach i,$(USR_SBIN), \
6dea60aa
CE
133 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \
134 install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
304db5da 135 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
6285b251 136 $(foreach i,$(SERVICE_BIN), \
304db5da 137 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
6285b251 138 $(MAKE) -C www install
bb5c7707 139 $(MAKE) -C docs install
729e38f4
DM
140
141.PHONY: upload
10426c17 142upload: ${SERVER_DEB} ${CLIENT_DEB} ${DOC_DEB}
729e38f4
DM
143 # check if working directory is clean
144 git diff --exit-code --stat && git diff --exit-code --stat --staged
10426c17
DM
145 tar cf - ${SERVER_DEB} ${DOC_DEB} | ssh -X repoman@repo.proxmox.com upload --product pbs --dist buster
146 tar cf - ${CLIENT_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pbs,pve" --dist buster