1 include /usr
/share
/dpkg
/default.mk
4 PACKAGE
:= proxmox-backup
5 ARCH
:= $(DEB_BUILD_ARCH
)
7 SUBDIRS
:= etc www docs
9 # Binaries usable by users
11 proxmox-backup-client \
12 proxmox-file-restore \
18 # Binaries usable by admins
20 proxmox-backup-manager \
23 # Binaries for services:
26 proxmox-backup-banner \
27 proxmox-backup-proxy \
30 # Single file restore daemon
32 proxmox-restore-daemon
34 SUBCRATES
!= cargo metadata
--no-deps
--format-version
=1 \
35 | jq
-r .workspace_members
'[]' \
36 | awk
'!/^proxmox-backup[[:space:]]/ { printf "%s ", $$1 }'
38 ifeq ($(BUILD_MODE
), release
)
39 CARGO_BUILD_ARGS
+= --release
40 COMPILEDIR
:= target
/release
42 COMPILEDIR
:= target
/debug
45 ifeq ($(valgrind
), yes
)
46 CARGO_BUILD_ARGS
+= --features valgrind
52 $(addprefix $(COMPILEDIR
)/,$(USR_BIN
) $(USR_SBIN
) $(SERVICE_BIN
) $(RESTORE_BIN
))
54 export DEB_VERSION DEB_VERSION_UPSTREAM
56 SERVER_DEB
=$(PACKAGE
)-server_
$(DEB_VERSION
)_
$(ARCH
).deb
57 SERVER_DBG_DEB
=$(PACKAGE
)-server-dbgsym_
$(DEB_VERSION
)_
$(ARCH
).deb
58 CLIENT_DEB
=$(PACKAGE
)-client_
$(DEB_VERSION
)_
$(ARCH
).deb
59 CLIENT_DBG_DEB
=$(PACKAGE
)-client-dbgsym_
$(DEB_VERSION
)_
$(ARCH
).deb
60 RESTORE_DEB
=proxmox-backup-file-restore_
$(DEB_VERSION
)_
$(ARCH
).deb
61 RESTORE_DBG_DEB
=proxmox-backup-file-restore-dbgsym_
$(DEB_VERSION
)_
$(ARCH
).deb
62 DOC_DEB
=$(PACKAGE
)-docs_
$(DEB_VERSION
)_all.deb
64 DEBS
=$(SERVER_DEB
) $(SERVER_DBG_DEB
) $(CLIENT_DEB
) $(CLIENT_DBG_DEB
) \
65 $(RESTORE_DEB
) $(RESTORE_DBG_DEB
) $(DEBUG_DEB
) $(DEBUG_DBG_DEB
)
67 DSC
= rust-
$(PACKAGE
)_
$(DEB_VERSION
).dsc
80 #cargo test test_broadcast_future
81 #cargo test $(CARGO_BUILD_ARGS)
82 $(CARGO
) test $(tests
) $(CARGO_BUILD_ARGS
)
85 $(CARGO
) doc
--workspace
--no-deps
$(CARGO_BUILD_ARGS
)
87 # always re-create this dir
92 git rev-parse HEAD
> build
/.repoid
96 docs etc examples tests www zsh-completions \
99 rm -f build
/Cargo.lock
100 find build
/debian
-name
"*.hint" -delete
101 $(foreach i
,$(SUBDIRS
), \
102 $(MAKE
) -C build
/$(i
) clean ;)
105 .PHONY
: proxmox-backup-docs
106 $(DOC_DEB
) $(DEBS
): proxmox-backup-docs
107 proxmox-backup-docs
: build
108 cd build
; dpkg-buildpackage
-b
-us
-uc
--no-pre-clean
111 # copy the local target/ dir as a build-cache
112 .PHONY
: deb dsc deb-nodoc
114 cd build
; dpkg-buildpackage
-b
-us
-uc
--no-pre-clean
--build-profiles
=nodoc
119 cd build
; dpkg-buildpackage
-b
-us
-uc
120 lintian
$(DEBS
) $(DOC_DEB
)
129 cd build
; dpkg-buildpackage
-S
-us
-uc
-d
134 .PHONY
: clean distclean deb
clean
137 $(foreach i
,$(SUBDIRS
), \
138 $(MAKE
) -C
$(i
) clean ;)
140 rm -f .do-cargo-build
142 # allows one to avoid running cargo clean when one just wants to tidy up after a package build
145 rm -f
*.deb
*.dsc
*.
tar.
* *.buildinfo
*.build
*.changes
148 dinstall
: $(SERVER_DEB
) $(SERVER_DBG_DEB
) $(CLIENT_DEB
) $(CLIENT_DBG_DEB
) \
149 $(DEBUG_DEB
) $(DEBUG_DBG_DEB
)
152 # make sure we build binaries before docs
153 docs
: $(COMPILEDIR
)/dump-catalog-shell-cli
$(COMPILEDIR
)/docgen
157 rm -f .do-cargo-build
158 $(MAKE
) $(COMPILED_BINS
)
160 $(COMPILED_BINS
) $(COMPILEDIR
)/dump-catalog-shell-cli
$(COMPILEDIR
)/docgen
: .do-cargo-build
162 $(CARGO
) build
$(CARGO_BUILD_ARGS
) \
163 --package proxmox-backup-banner \
164 --bin proxmox-backup-banner \
165 --package proxmox-backup-client \
166 --bin proxmox-backup-client \
167 --bin dump-catalog-shell-cli \
168 --bin proxmox-backup-debug \
169 --package proxmox-file-restore \
170 --bin proxmox-file-restore \
176 --package proxmox-restore-daemon \
177 --bin proxmox-restore-daemon \
178 --package proxmox-backup \
180 --bin proxmox-backup-api \
181 --bin proxmox-backup-manager \
182 --bin proxmox-backup-proxy \
183 --bin proxmox-daily-update \
184 --bin proxmox-file-restore \
192 cargo clippy
-- -A clippy
::all -D clippy
::correctness
194 install: $(COMPILED_BINS
)
195 install -dm755
$(DESTDIR
)$(BINDIR
)
196 install -dm755
$(DESTDIR
)$(ZSH_COMPL_DEST
)
197 $(foreach i
,$(USR_BIN
), \
198 install -m755
$(COMPILEDIR
)/$(i
) $(DESTDIR
)$(BINDIR
)/ ; \
199 install -m644 zsh-completions
/_
$(i
) $(DESTDIR
)$(ZSH_COMPL_DEST
)/ ;)
200 install -dm755
$(DESTDIR
)$(SBINDIR
)
201 $(foreach i
,$(USR_SBIN
), \
202 install -m755
$(COMPILEDIR
)/$(i
) $(DESTDIR
)$(SBINDIR
)/ ; \
203 install -m644 zsh-completions
/_
$(i
) $(DESTDIR
)$(ZSH_COMPL_DEST
)/ ;)
204 install -m755
$(COMPILEDIR
)/pbs2to3
$(DESTDIR
)$(SBINDIR
)/
205 install -dm755
$(DESTDIR
)$(LIBEXECDIR
)/proxmox-backup
206 install -dm755
$(DESTDIR
)$(LIBEXECDIR
)/proxmox-backup
/file-restore
207 $(foreach i
,$(RESTORE_BIN
), \
208 install -m755
$(COMPILEDIR
)/$(i
) $(DESTDIR
)$(LIBEXECDIR
)/proxmox-backup
/file-restore
/ ;)
209 # install sg-tape-cmd as setuid binary
210 install -m4755
-o root
-g root
$(COMPILEDIR
)/sg-tape-cmd
$(DESTDIR
)$(LIBEXECDIR
)/proxmox-backup
/sg-tape-cmd
211 $(foreach i
,$(SERVICE_BIN
), \
212 install -m755
$(COMPILEDIR
)/$(i
) $(DESTDIR
)$(LIBEXECDIR
)/proxmox-backup
/ ;)
213 $(MAKE
) -C www
install
214 $(MAKE
) -C docs
install
217 upload
: UPLOAD_DIST ?
= $(DEB_DISTRIBUTION
)
218 upload
: $(SERVER_DEB
) $(CLIENT_DEB
) $(RESTORE_DEB
) $(DOC_DEB
) $(DEBUG_DEB
)
219 # check if working directory is clean
220 git diff
--exit-code
--stat
&& git diff
--exit-code
--stat
--staged
221 tar cf
- $(SERVER_DEB
) $(SERVER_DBG_DEB
) $(DOC_DEB
) $(CLIENT_DEB
) \
222 $(CLIENT_DBG_DEB
) $(DEBUG_DEB
) $(DEBUG_DBG_DEB
) \
223 | ssh
-X repoman@repo.proxmox.com upload
--product pbs
--dist $(UPLOAD_DIST
)
224 tar cf
- $(CLIENT_DEB
) $(CLIENT_DBG_DEB
) | ssh
-X repoman@repo.proxmox.com upload
--product
"pve,pmg,pbs-client" --dist $(UPLOAD_DIST
)
225 tar cf
- $(RESTORE_DEB
) $(RESTORE_DBG_DEB
) | ssh
-X repoman@repo.proxmox.com upload
--product
"pve" --dist $(UPLOAD_DIST
)