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