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