]>
Commit | Line | Data |
---|---|---|
da0e1e40 | 1 | include /usr/share/dpkg/default.mk |
6285b251 | 2 | include defines.mk |
de779814 | 3 | |
e881b8a5 | 4 | PACKAGE := proxmox-backup |
da0e1e40 | 5 | ARCH := $(DEB_BUILD_ARCH) |
209bb433 | 6 | |
bb5c7707 | 7 | SUBDIRS := etc www docs |
13b77d10 | 8 | |
6285b251 WB |
9 | # Binaries usable by users |
10 | USR_BIN := \ | |
c9727044 | 11 | proxmox-backup-client \ |
76425d84 | 12 | proxmox-file-restore \ |
c9727044 | 13 | pxar \ |
cc2c5c77 | 14 | proxmox-tape \ |
4c209d6b DM |
15 | pmtx \ |
16 | pmt | |
6285b251 WB |
17 | |
18 | # Binaries usable by admins | |
b69b8af2 TL |
19 | USR_SBIN := \ |
20 | proxmox-backup-manager | |
6285b251 WB |
21 | |
22 | # Binaries for services: | |
23 | SERVICE_BIN := \ | |
24 | proxmox-backup-api \ | |
b69b8af2 | 25 | proxmox-backup-banner \ |
bc00289b | 26 | proxmox-backup-proxy \ |
b27c3282 | 27 | proxmox-daily-update |
6285b251 | 28 | |
dd9cef56 SR |
29 | # Single file restore daemon |
30 | RESTORE_BIN := \ | |
31 | proxmox-restore-daemon | |
32 | ||
01fd2447 | 33 | SUBCRATES := \ |
86fb3877 | 34 | pbs-api-types \ |
d420962f | 35 | pbs-buildcfg \ |
2b7f8dd5 | 36 | pbs-client \ |
f323e906 | 37 | pbs-datastore \ |
770a36e5 | 38 | pbs-runtime \ |
067dc06d | 39 | pbs-systemd \ |
b9c5cd82 | 40 | pbs-tools \ |
58a3fae7 WB |
41 | proxmox-backup-banner \ |
42 | pxar-bin | |
01fd2447 | 43 | |
13b77d10 WB |
44 | ifeq ($(BUILD_MODE), release) |
45 | CARGO_BUILD_ARGS += --release | |
6285b251 | 46 | COMPILEDIR := target/release |
13b77d10 WB |
47 | else |
48 | COMPILEDIR := target/debug | |
49 | endif | |
50 | ||
6f0069ae WB |
51 | ifeq ($(valgrind), yes) |
52 | CARGO_BUILD_ARGS += --features valgrind | |
53 | endif | |
54 | ||
da0e1e40 FG |
55 | CARGO ?= cargo |
56 | ||
6285b251 | 57 | COMPILED_BINS := \ |
dd9cef56 | 58 | $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(RESTORE_BIN)) |
6285b251 | 59 | |
1f6a4f58 TL |
60 | export DEB_VERSION DEB_VERSION_UPSTREAM |
61 | ||
10426c17 | 62 | SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb |
3ec6e249 | 63 | SERVER_DBG_DEB=${PACKAGE}-server-dbgsym_${DEB_VERSION}_${ARCH}.deb |
10426c17 | 64 | CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb |
3ec6e249 | 65 | CLIENT_DBG_DEB=${PACKAGE}-client-dbgsym_${DEB_VERSION}_${ARCH}.deb |
a5322f3c TL |
66 | RESTORE_DEB=proxmox-backup-file-restore_${DEB_VERSION}_${ARCH}.deb |
67 | RESTORE_DBG_DEB=proxmox-backup-file-restore-dbgsym_${DEB_VERSION}_${ARCH}.deb | |
da0e1e40 | 68 | DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb |
36d74cd6 | 69 | |
76425d84 DC |
70 | DEBS=${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \ |
71 | ${RESTORE_DEB} ${RESTORE_DBG_DEB} | |
10426c17 | 72 | |
e881b8a5 | 73 | DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc |
209bb433 DM |
74 | |
75 | DESTDIR= | |
de779814 | 76 | |
314d360f WB |
77 | tests ?= --workspace |
78 | ||
424d2d68 | 79 | all: $(SUBDIRS) |
13b77d10 WB |
80 | |
81 | .PHONY: $(SUBDIRS) | |
82 | $(SUBDIRS): | |
83 | $(MAKE) -C $@ | |
de779814 | 84 | |
cd3b9a06 | 85 | test: |
cc119edb | 86 | #cargo test test_broadcast_future |
3dceb9b3 | 87 | #cargo test $(CARGO_BUILD_ARGS) |
c47a900c | 88 | $(CARGO) test $(tests) $(CARGO_BUILD_ARGS) |
f7dd683b | 89 | |
cd3b9a06 | 90 | doc: |
314d360f | 91 | $(CARGO) doc --workspace --no-deps $(CARGO_BUILD_ARGS) |
d78345bc | 92 | |
13b77d10 WB |
93 | # always re-create this dir |
94 | .PHONY: build | |
95 | build: | |
de779814 | 96 | rm -rf build |
01fd2447 WB |
97 | mkdir build |
98 | cp -a debian \ | |
a6eac535 | 99 | Cargo.toml src \ |
01fd2447 WB |
100 | $(SUBCRATES) \ |
101 | docs etc examples tests www zsh-completions \ | |
102 | defines.mk Makefile \ | |
103 | ./build/ | |
104 | rm -f build/Cargo.lock | |
e881b8a5 | 105 | find build/debian -name "*.hint" -delete |
b369f720 WB |
106 | $(foreach i,$(SUBDIRS), \ |
107 | $(MAKE) -C build/$(i) clean ;) | |
de779814 | 108 | |
e881b8a5 | 109 | |
720776b8 | 110 | .PHONY: proxmox-backup-docs |
37e53b4c TL |
111 | $(DOC_DEB) $(DEBS): proxmox-backup-docs |
112 | proxmox-backup-docs: build | |
720776b8 DM |
113 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean |
114 | lintian $(DOC_DEB) | |
115 | ||
da0e1e40 | 116 | # copy the local target/ dir as a build-cache |
13b77d10 | 117 | .PHONY: deb |
37e53b4c TL |
118 | $(DEBS): deb |
119 | deb: build | |
720776b8 | 120 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc |
36d74cd6 | 121 | lintian $(DEBS) |
18fad344 | 122 | |
37e53b4c | 123 | .PHONY: deb-all |
a2c73c78 TL |
124 | deb-all: build |
125 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean | |
126 | lintian $(DEBS) $(DOC_DEB) | |
37e53b4c | 127 | |
18fad344 WB |
128 | .PHONY: dsc |
129 | dsc: $(DSC) | |
130 | $(DSC): build | |
131 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
132 | lintian $(DSC) | |
de779814 | 133 | |
1900d781 | 134 | .PHONY: clean distclean deb clean |
209bb433 | 135 | distclean: clean |
6b85671d | 136 | clean: clean-deb |
b369f720 WB |
137 | $(foreach i,$(SUBDIRS), \ |
138 | $(MAKE) -C $(i) clean ;) | |
da0e1e40 | 139 | $(CARGO) clean |
424d2d68 | 140 | rm -f .do-cargo-build |
d3cb69c4 DM |
141 | find . -name '*~' -exec rm {} ';' |
142 | ||
1900d781 TL |
143 | # allows one to avoid running cargo clean when one just wants to tidy up after a packgae build |
144 | clean-deb: | |
145 | rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build/ | |
146 | ||
209bb433 | 147 | .PHONY: dinstall |
c287b287 TL |
148 | dinstall: ${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} |
149 | dpkg -i $^ | |
6285b251 | 150 | |
bb5c7707 | 151 | # make sure we build binaries before docs |
424d2d68 | 152 | docs: $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen |
bb5c7707 | 153 | |
13b77d10 | 154 | .PHONY: cargo-build |
cd3b9a06 | 155 | cargo-build: |
424d2d68 TL |
156 | rm -f .do-cargo-build |
157 | $(MAKE) $(COMPILED_BINS) | |
158 | ||
159 | $(COMPILED_BINS) $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen: .do-cargo-build | |
160 | .do-cargo-build: | |
991be99c | 161 | RUSTFLAGS="--cfg openid" $(CARGO) build $(CARGO_BUILD_ARGS) \ |
f726e1e0 TL |
162 | --bin proxmox-backup-api \ |
163 | --bin proxmox-backup-proxy \ | |
164 | --bin proxmox-backup-manager \ | |
165 | --bin docgen | |
991be99c | 166 | $(CARGO) build $(CARGO_BUILD_ARGS) \ |
b9c5cd82 WB |
167 | --package proxmox-backup-banner \ |
168 | --bin proxmox-backup-banner \ | |
58a3fae7 WB |
169 | --package pxar-bin \ |
170 | --bin pxar \ | |
b9c5cd82 | 171 | --package proxmox-backup \ |
991be99c TL |
172 | --bin dump-catalog-shell-cli \ |
173 | --bin pmt --bin pmtx \ | |
991be99c TL |
174 | --bin proxmox-backup-client \ |
175 | --bin proxmox-daily-update \ | |
176 | --bin proxmox-file-restore \ | |
177 | --bin proxmox-restore-daemon \ | |
178 | --bin proxmox-tape \ | |
179 | --bin pxar \ | |
180 | --bin sg-tape-cmd | |
424d2d68 | 181 | touch "$@" |
6285b251 | 182 | |
6285b251 | 183 | |
d1596102 WB |
184 | .PHONY: lint |
185 | lint: | |
186 | cargo clippy -- -A clippy::all -D clippy::correctness | |
187 | ||
6285b251 WB |
188 | install: $(COMPILED_BINS) |
189 | install -dm755 $(DESTDIR)$(BINDIR) | |
6dea60aa | 190 | install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST) |
6285b251 | 191 | $(foreach i,$(USR_BIN), \ |
6dea60aa CE |
192 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \ |
193 | install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;) | |
6285b251 WB |
194 | install -dm755 $(DESTDIR)$(SBINDIR) |
195 | $(foreach i,$(USR_SBIN), \ | |
6dea60aa CE |
196 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \ |
197 | install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;) | |
304db5da | 198 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
dd9cef56 SR |
199 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore |
200 | $(foreach i,$(RESTORE_BIN), \ | |
201 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore/ ;) | |
b27c3282 | 202 | # install sg-tape-cmd as setuid binary |
df3a74d7 | 203 | install -m4755 -o root -g root $(COMPILEDIR)/sg-tape-cmd $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/sg-tape-cmd |
6285b251 | 204 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 205 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 206 | $(MAKE) -C www install |
bb5c7707 | 207 | $(MAKE) -C docs install |
7190cbf2 | 208 | $(MAKE) test # HACK, only test now to avoid clobbering build files with wrong config |
729e38f4 DM |
209 | |
210 | .PHONY: upload | |
76425d84 | 211 | upload: ${SERVER_DEB} ${CLIENT_DEB} ${RESTORE_DEB} ${DOC_DEB} |
729e38f4 DM |
212 | # check if working directory is clean |
213 | git diff --exit-code --stat && git diff --exit-code --stat --staged | |
59648eac | 214 | tar cf - ${SERVER_DEB} ${SERVER_DBG_DEB} ${DOC_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} | \ |
d9d81741 TL |
215 | ssh -X repoman@repo.proxmox.com upload --product pbs --dist bullseye |
216 | tar cf - ${CLIENT_DEB} ${CLIENT_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve,pmg,pbs-client" --dist bullseye | |
217 | tar cf - ${RESTORE_DEB} ${RESTORE_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve" --dist bullseye |